Files
deepseek-harness/packages/goal/tool-goal
Turtle 38c7a9fbf4 feat(release): publish package source, declaration maps, and documentation (#5884)
* feat(release): publish package source, declaration maps, and documentation

Every release member publishes its TypeScript source and the declaration
maps that resolve into it, and @deepseek-ai/dsh publishes the repository
Markdown documentation staged from docs/ at prepack time.

The ./src/* export most members already declared now resolves for an
installed consumer, and a consumer editor follows a declaration to the
implementation. Bundled JavaScript maps stay unpublished; the vendored
family and the Desktop runtime file policy are unchanged.

Rationale: .agents/notes/implemented/process/2026-10-08-published-source-and-docs.md

* feat(release): publish JavaScript maps and compress bundles

Every emitted JavaScript map ships beside the bundle it describes, and the
workspace build and the client preset compress bundles without mangling
identifiers.

The documentation payload now mirrors the website publication manifest and
is removed again by `postpack`; Desktop and the Python executable exclude
the published source, documentation, and maps; `clean` removes a staged
copy. Typert's publication contract gains the Remote declaration map.

* fix(release): keep node bundles readable for the worker image

The browser worker image lowers `yield*` only as a whole statement and
rewrites `for await` loops by their source layout, so compressed node-side
entries either fail that lowering or lower to unparseable code. Only the
browser bundles keep compression, which removes about a third of their text.

The bundle-purity assertion now matches the module-loader call regardless of
the quote style compression picks, and the release-pack fixture exercises
the installed package's new documentation requirement.

* feat(release): publish the whole documentation tree

`@deepseek-ai/dsh` copies `docs/` in full instead of the website's page
set: the maintainer documents, the generated migration records, the
translation guidelines, and the `*.i18n.yaml` consistency records ship
with the installed package, so the documentation's own links resolve
without a checkout.

* feat(release): publish the upgrade guides with the documentation

The staged documentation keeps the website's page set and adds every
`docs/upgrade-guide/` document, which is what an installed reader consults
when a released change breaks something. The rest of the maintainer tree
stays out.

* test(release): expect source and maps in master's new payload cases

* feat(release): keep installed docs and source readable in Desktop

Desktop keeps the published src/ and docs/ trees inside app.asar, and
every model shell call receives DSH_INSTALL_DIR and DSH_NODE_EXECUTABLE
so an agent can read them through Electron's Node mode. Staging also
generates docs/upgrade-guide/README.md, an index of the upgrade guides
grouped by the release they upgrade from.

Minified client bundles print string literals with backticks: the
worker image packer now recognizes those chunk requests, client license
banners are prepended after minification so their text survives, and
the affected artifact tests accept either quote.

* test(desktop): read archived docs through the Windows PowerShell form

Regenerate the config catalog for the shifted shell-env source line.

* test(desktop): wait for the GUI-subsystem Electron process from PowerShell

* build(release): publish source and maps from the message-quotes package

* build(release): publish source and maps from packages new on master

* build(release): publish source and maps from the tool-office package
2026-11-05 00:22:36 +08:00
..
2026-10-29 17:43:46 +08:00

description, kind
description kind
The model-facing goal tools for users and maintainers choosing, composing, or debugging get_goal, create_goal, and update_goal. package-reference

@deepseek-ai/dsh-tool-goal

English | 中文

Summary

dsh-tool-goal lets a model read persisted goals and infer and create a long-running goal from a direct human request. Creating, editing, pausing, or resuming requires that direct request in a top-level agent turn; completing or blocking also works in an autonomous goal round. Updates require the exact goal id and revision returned by a prior read. resume rearms active-but-disarmed or blocked goals, while users resume durable paused goals through Web or /goal resume. Autonomous blocking requires the same condition for a configurable threshold of three consecutive rounds by default.

Table of Contents


Use this package

Mount dsh-tool-goal beside the goal service when the model should create and update persisted goals itself. The tools are the model-facing half of the goal surface; the /goal command is the human-facing half, and the continuation driver uses the same tools to complete or block goals at the end of autonomous rounds.

Tools

All three tools return the same compact JSON — { goal: null } when no goal is current, otherwise the goal's id, revision, objective, phase, rounds started, round cap, optional blocker reason, and whether continuation is armed — matching what Native callers already render.

Tool What it does
get_goal() Reads the current goal, or null when none is current
create_goal(objective, max_goal_rounds?) Creates one goal from a direct top-level human turn
update_goal(goal_id, revision, action, objective?, max_goal_rounds?, blocked_reason?) edit, pause, resume, complete, or blocked on the exact goal revision

Call get_goal before update_goal and copy the exact goal_id and revision; all calls are exclusive, so a model-ordered batch observes earlier mutations and their new revisions. objective and max_goal_rounds affect only edit and are ignored for all other actions. blocked_reason is required and non-empty for blocked, persisted with the stable code model-reported, and ignored for all other actions. Ignored fields cannot change the objective, round cap, or blocker reason. Declared types, authority, and exact-revision checks still apply. For edit, exact empty-string objectives and zero round caps count as omitted, and at least one meaningful replacement is required.

Configure it

- id: tool-goal
  name: '@deepseek-ai/dsh-tool-goal'
  config:
    blockedAfterConsecutiveRounds: 3

The value must be a positive safe integer. It supplies both the hard lower bound on model self-blocking and the number named in model guidance. The generated configuration catalog is the exhaustive source for every accepted field.

Authority rules

The tools execute only for the exact live calling agent inside its active driver with an open turn. create, edit, pause, and resume additionally require a direct human message in a runtime-root agent's current turn — a subagent or a non-human producer cannot create or edit goals. resume rejects a durable paused goal before the goal service runs; that state belongs to the user-facing resume path. complete and blocked also accept the exact current goal round: a goal-sourced round may complete the goal immediately, but a blocked call is mechanically rejected until the configured number of consecutive rounds has passed — the model judges whether the same condition actually persisted and must describe it in blocked_reason. A direct human request may stop a goal immediately.

An autonomous round that successfully reports complete or blocked also ends the physical turn after that step, and the model receives a closing instruction to write the final message to the user. Direct-human mutations never trigger that stop: the assistant may acknowledge the change and the loop keeps concurrent human steering available.


Understand the implementation

Implementation internals — click to expand

This section explains how the tools enforce authority and render output; the observable contract is covered in Use this package.

Design

  • Authority at execution. The plugin requires agents and reads turn state through turnBoundaryOf(session). Every call resolves the exact live agent, its inherited AgentRegistry initiator, running status, and an open turn; create, edit, pause, and resume additionally require an accepted { kind: 'user' } message or steering event in a runtime-root agent's current turn. A durable paused goal fails the resume action with GOAL_TOOL_RESUME_PAUSED; the user-facing command or Web control owns that transition. A Session with origin: 'subagent' cannot supply direct-human authority; historical ordinary forks with parentSession remain eligible.
  • Host attestation of human input. { kind: 'user' } is assigned by Agent.followup() and steer() when their caller omits a source, so plugins, schedulers, and other non-human producers must pass their own source rather than inheriting human authority.
  • System-prompt guidance with the configured threshold. The package registers one tool:goal system-prompt section whose fixed text interpolates blockedAfterConsecutiveRounds; the same value is the hard lower bound enforced at execution.
  • Wrap-up context for terminal rounds. A successful autonomous complete or blocked defers a closing <goal_complete> or <goal_blocked> instruction so the model addresses the user once before the turn ends; direct-human mutations never defer this context.

Source map

File Role
src/index.ts Plugin entry: tool registration, config, system-prompt section, result rendering
src/authority.ts Execution-time authority checks and goal-round acceptance
src/wrapup.ts Closing-message instruction for terminal autonomous updates

Tool output

All three tools share one canonical output: the compact JSON { goal: null } or { goal: { id, revision, objective, phase, roundsStarted, maxGoalRounds, blockedReason? }, activation }. activation in a result is a live observation and never becomes replay authority. UI clients receive pure generic cards — read for get_goal, other for mutations.


Further Exploration

The tools are the model-facing half of the goal surface; read these pages for the state they mutate and the policy they defer to.


Model Experience

System prompt

What the model sees

A fixed goal policy allows inferring goal intent in any language, explains rearming after resume/fork, and limits completion/blocking claims; creation scope and read-before-update refs live in the tool definitions. Durable paused resume is rejected at execution with GOAL_TOOL_RESUME_PAUSED; the user-facing goal control owns that transition. The configured threshold is interpolated into that guidance.

Goal policy
create_goal may infer goal intent from a direct human request in any language. After session resume or fork, an active goal is disarmed: when a human asks to continue or resume in any wording or language, use update_goal action resume to rearm it. Mark complete only when the objective is actually achieved. Mark blocked only after the same blocking condition persists for at least 3 consecutive goal rounds, and report that concrete condition in blocked_reason; difficulty, uncertainty, or useful remaining work is not blocked.

Token effect

Small fixed input cost on every request where this plugin's prompt registration is in scope.

KV Cache effect

Prefix-stable while the plugin scope, configured threshold, and guidance text are unchanged. Activation, disposal, or configuration changes may invalidate reuse from this prompt section.

Tool schemas and results

What the model sees

The generated get_goal, create_goal, and update_goal schemas. Successful results are compact JSON. A mutation appends the goal domain's durable goal/change event without queuing model context. activation in a result is a live observation and never becomes replay authority.

Token effect

Fixed schema cost plus one compact result per call. The durable mutation adds no separate model-visible context.

KV Cache effect

Schemas are prefix-stable while their definitions and visibility are unchanged. Calls and results append after the reusable request prefix without invalidating earlier entries.

Known Limitations and Deferred Work

These limits define when the goal tools are a poor fit or need special care. They are current package constraints, not a task backlog.

  • Semantic intent remains model judgment — execution can prove that the current turn contains a direct human message, not whether the request is substantial enough to merit a goal.
  • Same-condition blocking remains model judgment — the runtime enforces distinct admitted-round count, not semantic equivalence of obstacles; an independent evaluator is deferred.
  • No scheduling or direct human rendering — these tools mutate state only; the same-session driver and dsh-command-goal are independent consumers of the same domain.
  • Goal-round authority requires a driver — the autonomous complete/blocked path is dormant unless a continuation driver admits goal-sourced user turns; mounting this tool package alone does not create them.
  • Prompt registration is independent of filtering — a scope may hide the tools while retaining their guidance unless the deployment scopes both registrations together.

Dev Note

Working context for maintainers — click to expand

This Dev Note is working context for maintainers; it is explicitly non-authoritative. Open question: whether the goal-policy section should be independently scoped from the tool registrations, so a scope cannot hide the tools while keeping the guidance.