@gajae-code/coding-agent 0.8.2 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +29 -0
- package/dist/types/append-only-mode.d.ts +31 -0
- package/dist/types/capability/rule.d.ts +8 -0
- package/dist/types/cli/fixture-report.d.ts +20 -0
- package/dist/types/cli/fixture-report.test.d.ts +1 -0
- package/dist/types/cli/nofile-limit.d.ts +11 -0
- package/dist/types/cli/update-cli.d.ts +22 -0
- package/dist/types/config/settings-schema.d.ts +105 -1
- package/dist/types/discovery/index.d.ts +1 -0
- package/dist/types/export/html/template.generated.d.ts +1 -1
- package/dist/types/export/ttsr.d.ts +14 -3
- package/dist/types/gjc-runtime/deep-interview-state.d.ts +5 -2
- package/dist/types/gjc-runtime/session-state-sidecar.d.ts +7 -0
- package/dist/types/gjc-runtime/state-writer.d.ts +3 -0
- package/dist/types/gjc-runtime/team-runtime.d.ts +26 -0
- package/dist/types/gjc-runtime/ultragoal-receipt-freshness.d.ts +42 -0
- package/dist/types/gjc-runtime/ultragoal-runtime.d.ts +119 -13
- package/dist/types/goals/runtime.d.ts +1 -0
- package/dist/types/hooks/native-skill-hook.d.ts +12 -0
- package/dist/types/modes/components/assistant-message.d.ts +5 -1
- package/dist/types/modes/components/status-line.d.ts +9 -0
- package/dist/types/modes/controllers/command-controller.d.ts +1 -0
- package/dist/types/modes/controllers/event-controller.d.ts +5 -0
- package/dist/types/modes/interactive-mode.d.ts +2 -0
- package/dist/types/modes/rpc/rpc-types.d.ts +14 -0
- package/dist/types/modes/shared/agent-wire/event-contract.d.ts +19 -0
- package/dist/types/modes/shared/agent-wire/event-envelope.d.ts +23 -1
- package/dist/types/modes/types.d.ts +1 -0
- package/dist/types/modes/utils/ui-helpers.d.ts +1 -0
- package/dist/types/notifications/config.d.ts +6 -0
- package/dist/types/notifications/telegram-daemon.d.ts +8 -0
- package/dist/types/notifications/threaded-render.d.ts +6 -0
- package/dist/types/sdk.d.ts +3 -0
- package/dist/types/session/agent-session.d.ts +43 -1
- package/dist/types/session/file-mention-pruning.d.ts +8 -0
- package/dist/types/session/messages.d.ts +4 -0
- package/dist/types/session/session-manager.d.ts +17 -1
- package/dist/types/skill-state/active-state.d.ts +18 -1
- package/dist/types/system-prompt.d.ts +18 -2
- package/dist/types/task/executor.d.ts +1 -0
- package/dist/types/task/fork-context-budget.d.ts +7 -0
- package/dist/types/task/token-log.d.ts +30 -0
- package/dist/types/task/token-log.test.d.ts +1 -0
- package/dist/types/tools/bisect.d.ts +81 -0
- package/dist/types/tools/index.d.ts +1 -0
- package/dist/types/tools/search.d.ts +2 -2
- package/dist/types/utils/file-mentions.d.ts +14 -0
- package/dist/types/utils/git.d.ts +32 -0
- package/dist/types/web/scrapers/youtube.d.ts +8 -0
- package/package.json +7 -7
- package/src/append-only-mode.ts +58 -0
- package/src/autoresearch/prompt.md +1 -1
- package/src/autoresearch/tools/log-experiment.ts +1 -1
- package/src/capability/rule.ts +9 -0
- package/src/cli/config-cli.ts +27 -3
- package/src/cli/fixture-report.test.ts +230 -0
- package/src/cli/fixture-report.ts +171 -0
- package/src/cli/nofile-limit.ts +48 -0
- package/src/cli/update-cli.ts +85 -9
- package/src/cli.ts +26 -0
- package/src/commands/contribution-prep.ts +1 -1
- package/src/config/settings-schema.ts +68 -1
- package/src/defaults/gjc/skills/deep-interview/SKILL.md +12 -13
- package/src/defaults/gjc/skills/ralplan/SKILL.md +30 -93
- package/src/defaults/gjc/skills/team/SKILL.md +16 -13
- package/src/defaults/gjc/skills/ultragoal/SKILL.md +59 -4
- package/src/defaults/gjc/skills/ultragoal/pipeline-validation-contracts.md +30 -0
- package/src/defaults/gjc-defaults.ts +9 -0
- package/src/discovery/helpers.ts +10 -0
- package/src/discovery/index.ts +1 -0
- package/src/export/html/template.generated.ts +1 -1
- package/src/export/html/template.js +60 -2
- package/src/export/ttsr.ts +96 -18
- package/src/extensibility/extensions/runner.ts +181 -219
- package/src/extensibility/gjc-plugins/runtime-adapters.ts +156 -44
- package/src/gjc-runtime/deep-interview-state.ts +31 -2
- package/src/gjc-runtime/session-state-sidecar.ts +208 -13
- package/src/gjc-runtime/state-writer.ts +15 -0
- package/src/gjc-runtime/team-runtime.ts +164 -15
- package/src/gjc-runtime/ultragoal-guard.ts +55 -66
- package/src/gjc-runtime/ultragoal-receipt-freshness.ts +315 -0
- package/src/gjc-runtime/ultragoal-runtime.ts +1593 -143
- package/src/gjc-runtime/workflow-manifest.generated.json +113 -2
- package/src/gjc-runtime/workflow-manifest.ts +74 -1
- package/src/goals/runtime.ts +10 -2
- package/src/hindsight/backend.ts +1 -3
- package/src/hooks/native-skill-hook.ts +95 -4
- package/src/internal-urls/docs-index.generated.ts +14 -5
- package/src/main.ts +43 -2
- package/src/memories/index.ts +12 -1
- package/src/modes/components/assistant-message.ts +241 -82
- package/src/modes/components/custom-editor.ts +1 -0
- package/src/modes/components/status-line.ts +167 -54
- package/src/modes/components/tool-execution.ts +44 -19
- package/src/modes/controllers/command-controller.ts +39 -2
- package/src/modes/controllers/event-controller.ts +66 -47
- package/src/modes/controllers/input-controller.ts +1 -1
- package/src/modes/interactive-mode.ts +9 -1
- package/src/modes/rpc/rpc-mode.ts +29 -3
- package/src/modes/rpc/rpc-types.ts +9 -0
- package/src/modes/shared/agent-wire/command-validation.ts +4 -0
- package/src/modes/shared/agent-wire/event-contract.ts +22 -0
- package/src/modes/shared/agent-wire/event-envelope.ts +82 -0
- package/src/modes/shared/agent-wire/scopes.ts +1 -0
- package/src/modes/types.ts +1 -0
- package/src/modes/utils/ui-helpers.ts +17 -4
- package/src/notifications/config.ts +16 -4
- package/src/notifications/index.ts +78 -5
- package/src/notifications/telegram-daemon-cli.ts +2 -2
- package/src/notifications/telegram-daemon-control.ts +2 -2
- package/src/notifications/telegram-daemon.ts +85 -8
- package/src/notifications/threaded-render.ts +17 -1
- package/src/prompts/agents/architect.md +19 -10
- package/src/prompts/agents/critic.md +16 -18
- package/src/prompts/agents/executor.md +14 -11
- package/src/prompts/agents/planner.md +18 -13
- package/src/prompts/ci-green-request.md +3 -8
- package/src/prompts/goals/goal-continuation.md +0 -5
- package/src/prompts/goals/goal-mode-active.md +0 -5
- package/src/prompts/system/agent-creation-architect.md +2 -2
- package/src/prompts/system/plan-mode-active.md +1 -1
- package/src/prompts/system/plan-mode-subagent.md +3 -3
- package/src/prompts/system/project-prompt.md +0 -13
- package/src/prompts/system/subagent-system-prompt.md +3 -2
- package/src/prompts/system/system-prompt.md +26 -19
- package/src/prompts/system/volatile-project-context.md +10 -0
- package/src/prompts/system/web-search.md +4 -7
- package/src/prompts/tools/apply-patch.md +6 -0
- package/src/prompts/tools/ast-edit.md +1 -0
- package/src/prompts/tools/bash.md +1 -1
- package/src/prompts/tools/bisect.md +22 -0
- package/src/prompts/tools/browser.md +1 -1
- package/src/prompts/tools/cron.md +0 -2
- package/src/prompts/tools/eval.md +2 -2
- package/src/prompts/tools/find.md +1 -1
- package/src/prompts/tools/github.md +6 -6
- package/src/prompts/tools/goal.md +1 -3
- package/src/prompts/tools/image-gen.md +12 -5
- package/src/prompts/tools/irc.md +5 -4
- package/src/prompts/tools/job.md +2 -2
- package/src/prompts/tools/lsp.md +1 -1
- package/src/prompts/tools/monitor.md +2 -2
- package/src/prompts/tools/patch.md +2 -2
- package/src/prompts/tools/replace.md +2 -21
- package/src/prompts/tools/rewind.md +1 -1
- package/src/prompts/tools/search-tool-bm25.md +1 -11
- package/src/prompts/tools/search.md +1 -1
- package/src/prompts/tools/skill.md +3 -2
- package/src/prompts/tools/ssh.md +2 -1
- package/src/prompts/tools/subagent.md +2 -2
- package/src/prompts/tools/task.md +4 -5
- package/src/prompts/tools/todo-write.md +1 -1
- package/src/prompts/tools/vim.md +1 -0
- package/src/prompts/tools/web-search.md +2 -0
- package/src/prompts/tools/write.md +8 -2
- package/src/sdk.ts +32 -22
- package/src/session/agent-session.ts +732 -107
- package/src/session/file-mention-pruning.ts +64 -0
- package/src/session/messages.ts +4 -0
- package/src/session/session-manager.ts +59 -2
- package/src/skill-state/active-state.ts +141 -5
- package/src/skill-state/deep-interview-mutation-guard.ts +67 -3
- package/src/slash-commands/builtin-registry.ts +65 -0
- package/src/system-prompt.ts +57 -16
- package/src/task/executor.ts +125 -20
- package/src/task/fork-context-advisory.ts +2 -7
- package/src/task/fork-context-budget.ts +9 -0
- package/src/task/index.ts +4 -3
- package/src/task/output-manager.ts +4 -2
- package/src/task/token-log.test.ts +188 -0
- package/src/task/token-log.ts +179 -0
- package/src/tools/bisect.ts +367 -0
- package/src/tools/index.ts +3 -0
- package/src/tools/output-meta.ts +116 -4
- package/src/tools/search.ts +8 -2
- package/src/tools/skill.ts +15 -0
- package/src/utils/file-mentions.ts +39 -7
- package/src/utils/git.ts +73 -0
- package/src/web/scrapers/youtube.ts +24 -12
|
@@ -6,7 +6,7 @@ Requirements:
|
|
|
6
6
|
- `report` is REQUIRED and must be concise, factual, and actionable.
|
|
7
7
|
- Include key findings, decisions, and any unresolved risks.
|
|
8
8
|
- Do not include raw scratch logs unless essential.
|
|
9
|
-
-
|
|
9
|
+
- `checkpoint`'s must-rewind-before-yield rule applies: never yield with a checkpoint still active.
|
|
10
10
|
|
|
11
11
|
Behavior:
|
|
12
12
|
- If no checkpoint is active, this tool errors.
|
|
@@ -5,7 +5,7 @@ Activate hidden tools (MCP and built-in) when you need a capability not in your
|
|
|
5
5
|
{{#if discoverableMCPToolCount}}Total discoverable tools available: {{discoverableMCPToolCount}}.{{/if}}
|
|
6
6
|
Input:
|
|
7
7
|
- `query` — required natural-language or keyword query
|
|
8
|
-
- `limit` — optional maximum number of tools to return and activate (default `8
|
|
8
|
+
- `limit` — optional maximum number of tools to return and activate (default `8`; start with 5–10 if unsure)
|
|
9
9
|
|
|
10
10
|
Behavior:
|
|
11
11
|
- Searches hidden tool metadata using BM25-style relevance ranking
|
|
@@ -14,16 +14,6 @@ Behavior:
|
|
|
14
14
|
- Repeated searches add to the active tool set; they do not remove earlier selections
|
|
15
15
|
- Newly activated tools become available before the next model call in the same overall turn
|
|
16
16
|
|
|
17
|
-
Notes:
|
|
18
|
-
Start with `limit` 5–10 if unsure.
|
|
19
|
-
- `query` is matched against tool metadata fields:
|
|
20
|
-
- `name`
|
|
21
|
-
- `label`
|
|
22
|
-
- `server_name` (MCP tools)
|
|
23
|
-
- `mcp_tool_name` (MCP tools)
|
|
24
|
-
- `description` / `summary`
|
|
25
|
-
- input schema property keys (`schema_keys`)
|
|
26
|
-
|
|
27
17
|
Not for repository/file/code search. Tool discovery only.
|
|
28
18
|
|
|
29
19
|
Returns JSON with:
|
|
@@ -2,7 +2,7 @@ Searches files using powerful regex matching.
|
|
|
2
2
|
|
|
3
3
|
<instruction>
|
|
4
4
|
- Supports Rust regex syntax (RE2-style — no lookaround or backreferences). Use line anchors or post-filters instead of (?!…)/(?<!…)
|
|
5
|
-
- `paths`
|
|
5
|
+
- `paths` accepts an array of files, directories, globs, or internal URLs; when omitted, the whole working directory is searched
|
|
6
6
|
- `paths` is an array; do not embed commas or spaces inside a single entry. Pass `["src", "tests"]` not `["src,tests"]`.
|
|
7
7
|
- Cross-line patterns are detected from literal `\n` or escaped `\\n` in `pattern`
|
|
8
8
|
</instruction>
|
|
@@ -8,14 +8,15 @@ Invoke another available skill in the current turn.
|
|
|
8
8
|
<instruction>
|
|
9
9
|
- `name` is the skill name as it appears in `/skill:<name>` (e.g. `ralplan`, `ultragoal`, `team`, `deep-interview`)
|
|
10
10
|
- `args` is the free-form argument string the skill would receive after `/skill:<name>` on the command line
|
|
11
|
-
- The
|
|
12
|
-
- The chain is refused
|
|
11
|
+
- The tool loads the callee's SKILL.md into the current turn and handles the caller→callee state handoff itself.
|
|
12
|
+
- The chain is refused while the caller skill is still active. If your current skill has not yet reached a terminal phase, prepare it first with `gjc state <skill> write --input '{"current_phase":"handoff"}' --json`; no other handoff command is needed.
|
|
13
13
|
- Call once per chain step. To chain `A → B → C`, A calls `skill(B)`; B's next agent turn calls `skill(C)`.
|
|
14
14
|
</instruction>
|
|
15
15
|
|
|
16
16
|
<critical>
|
|
17
17
|
- Do NOT use this tool to "remind yourself" of a skill you're already running. The current SKILL.md is already in your context.
|
|
18
18
|
- Do NOT chain into the same skill recursively. If a skill's flow needs another iteration, follow its in-document instructions.
|
|
19
|
+
- `name` MUST be one concrete skill name, NOT a glob or wildcard. Passing `*`, `?`, or a pattern like `git-*` is rejected immediately — the `--skills '*'` launch filter is unrelated to this tool's `name`.
|
|
19
20
|
- The chained skill's planning/execution-boundary rules still apply. Chaining does not grant execution approval.
|
|
20
21
|
</critical>
|
|
21
22
|
|
package/src/prompts/tools/ssh.md
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
Runs commands on remote hosts.
|
|
2
2
|
|
|
3
3
|
<instruction>
|
|
4
|
-
You MUST build commands from the reference below
|
|
4
|
+
You MUST build commands from the reference below.
|
|
5
|
+
The local coreutils restrictions (`cat`/`grep`/`find`/`head`/`tail` bans) do NOT apply on remote hosts — `read`/`search`/`find` cannot reach them, so these shell commands are the only tools available there.
|
|
5
6
|
</instruction>
|
|
6
7
|
|
|
7
8
|
<commands>
|
|
@@ -2,12 +2,12 @@ Lists, inspects, awaits, pauses, resumes, steers, or cancels detached task subag
|
|
|
2
2
|
|
|
3
3
|
Task launches return immediately. Use this tool when you need direct control over those running subagents. Prefer `subagent` for task subagents; generic `job` remains available for non-subagent jobs and compatibility fallback access.
|
|
4
4
|
|
|
5
|
-
`verbosity` controls output size: `receipt` (default) returns status metadata plus a single
|
|
5
|
+
`verbosity` controls output size: `receipt` (default) returns status metadata plus a single ≤280-character result/error preview and an `agent://<id>` output ref when available; `preview` returns ≤2000 characters; `full` returns ≤12000 characters and requires explicit `ids`.
|
|
6
6
|
|
|
7
7
|
# Operations
|
|
8
8
|
|
|
9
9
|
## `action: "list"`
|
|
10
|
-
Snapshot your visible detached subagents, including `running`, `paused`, `queued`, and terminal subagents when retained. Output is receipt-only by default; use `verbosity: "preview"` for a bounded preview or inspect explicit `ids` with `verbosity: "full"` when fuller retained text is necessary.
|
|
10
|
+
Snapshot your visible detached subagents, including `running`, `paused`, `queued`, and terminal subagents when retained. Optional `limit` (1–50) caps how many subagents are returned. Output is receipt-only by default; use `verbosity: "preview"` for a bounded preview or inspect explicit `ids` with `verbosity: "full"` when fuller retained text is necessary.
|
|
11
11
|
|
|
12
12
|
## `action: "inspect"`
|
|
13
13
|
Inspect selected subagents by `ids`; omit `ids` to inspect current running subagents. Terminal subagents return receipt-only output by default, with an `agent://<id>` ref when a verified output artifact is available. `verbosity: "full"` requires explicit `ids`.
|
|
@@ -3,12 +3,11 @@ Launches subagents to parallelize workflows.
|
|
|
3
3
|
- Results are delivered automatically when complete.
|
|
4
4
|
- The tool result lists the assigned task ids (e.g. `0-AuthLoader`) — those are the live agent ids.
|
|
5
5
|
{{#if ircEnabled}}
|
|
6
|
-
- Coordinate with running tasks via `irc` using those ids. `subagent` cancel terminates a task and **cannot carry a message
|
|
7
|
-
- If genuinely blocked on completion, wait with `subagent` action `await` and a timeout; timeout only bounds your wait and does not stop or fail the subagent.
|
|
6
|
+
- Coordinate with running tasks via `irc` using those ids. `subagent` cancel terminates a task and **cannot carry a message**.
|
|
8
7
|
{{else}}
|
|
9
|
-
-
|
|
10
|
-
- Use `subagent` action `inspect` or `list` to snapshot manager state; `cancel` only when a task has actually failed, gone off-track, or become unrecoverably wrong.
|
|
8
|
+
- Use `subagent` action `inspect` or `list` to snapshot manager state.
|
|
11
9
|
{{/if}}
|
|
10
|
+
- To wait or cancel, use the `subagent` tool; its await/cancel doctrine applies (never cancel just because an await timed out).
|
|
12
11
|
|
|
13
12
|
{{#if ircEnabled}}
|
|
14
13
|
Subagents have no conversation history, but they can reach you and their siblings live via the `irc` tool. Front-load every fact, file path, and direction they need in {{#if contextEnabled}}`context` or `assignment`{{else}}each `assignment`{{/if}}.
|
|
@@ -19,7 +18,7 @@ Subagents have no conversation history. Every fact, file path, and direction the
|
|
|
19
18
|
<parameters>
|
|
20
19
|
- `agent`: agent type for all tasks
|
|
21
20
|
- `tasks`: tasks to execute in parallel
|
|
22
|
-
- `.id`:
|
|
21
|
+
- `.id`: filesystem-safe, ≤48 chars, matching `[A-Za-z0-9][A-Za-z0-9_-]*`; prefer CamelCase
|
|
23
22
|
- `.description`: UI label only — subagent never sees it
|
|
24
23
|
- `.assignment`: complete self-contained instructions; one-liners and missing acceptance criteria are PROHIBITED
|
|
25
24
|
{{#if contextEnabled}}- `context`: shared background prepended to every assignment; session-specific only{{/if}}
|
|
@@ -12,7 +12,7 @@ Allowed `op` values are only `init`, `start`, `done`, `drop`, `rm`, `append`, an
|
|
|
12
12
|
|`start`|`task`|Mark in progress|
|
|
13
13
|
|`done`|`task` or `phase`|Mark completed|
|
|
14
14
|
|`drop`|`task` or `phase`|Mark abandoned|
|
|
15
|
-
|`rm`|`task` or `phase
|
|
15
|
+
|`rm`|`task` or `phase` or *(none = clear all tasks)*|Remove a task; with `phase`, empties the phase (the phase entry remains); bare `rm` clears every task in every phase|
|
|
16
16
|
|`append`|`phase`, `items: string[]`|Append tasks to `phase`; lazily creates phase|
|
|
17
17
|
|`note`|`task`, `text`|Append a note to a task. Reminders for future-you only.|
|
|
18
18
|
|
package/src/prompts/tools/vim.md
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
Vim-style `edit` mode. The tool name stays `edit`; every call requires `file`, and the buffer loads automatically on first use.
|
|
2
2
|
- `{"file": "path"}` - view file
|
|
3
3
|
- `{"file": "path", "steps": [{"kbd": ["…"], "insert": "…"}]}` - edit file
|
|
4
|
+
- `pause` (optional boolean) - a "paused" call skips the auto-save after its steps and may leave the last step in INSERT mode; the buffer stays open for the next call. Non-paused calls auto-save once after all steps complete.
|
|
4
5
|
|
|
5
6
|
**Multi-location edits: always edit highest line number first (bottom-up).** Each insert shifts lines below it.
|
|
6
7
|
|
|
@@ -3,9 +3,11 @@ Searches the web for up-to-date information beyond knowledge cutoff.
|
|
|
3
3
|
<instruction>
|
|
4
4
|
- You SHOULD prefer primary sources (papers, official docs) and corroborate key claims with multiple sources
|
|
5
5
|
- You MUST include links for cited sources in the final response
|
|
6
|
+
- Provider-neutral params: `recency` (freshness window), `limit`/`num_search_results` (result counts), `max_tokens`, `temperature`
|
|
6
7
|
</instruction>
|
|
7
8
|
|
|
8
9
|
<xai>
|
|
10
|
+
The parameters below apply ONLY when the active search provider is `xai`; ignore them (and never pass them) on any other provider.
|
|
9
11
|
- With provider `xai`, use `xai_search_mode: "web"` for normal web search, `"x"` for X/Twitter search, or `"web_and_x"` when both surfaces are relevant.
|
|
10
12
|
- xAI web filters: `allowed_domains` or `excluded_domains` (max 5, mutually exclusive), plus `enable_image_understanding` and `enable_image_search`.
|
|
11
13
|
- xAI X filters: `allowed_x_handles` or `excluded_x_handles` (max 20, mutually exclusive), `from_date`, `to_date`, `enable_image_understanding`, and `enable_video_understanding`.
|
|
@@ -3,10 +3,16 @@ Creates or overwrites file at specified path.
|
|
|
3
3
|
<conditions>
|
|
4
4
|
- Creating new files explicitly required by task
|
|
5
5
|
- Replacing entire file contents when editing would be more complex
|
|
6
|
-
- Supports `.tar`, `.tar.gz`, `.tgz`, and `.zip` archive entries via `archive.ext:path/inside/archive`
|
|
7
|
-
- Supports SQLite row operations via `db.sqlite:table` (insert), `db.sqlite:table:key` (update with JSON content, delete with empty content)
|
|
8
6
|
</conditions>
|
|
9
7
|
|
|
8
|
+
<instruction>
|
|
9
|
+
- Archives: write entries inside `.tar`, `.tar.gz`, `.tgz`, and `.zip` via `archive.ext:path/inside/archive`.
|
|
10
|
+
- SQLite rows:
|
|
11
|
+
- `db.sqlite:table` with JSON content — insert a row
|
|
12
|
+
- `db.sqlite:table:key` with JSON content — update the row with that primary key
|
|
13
|
+
- `db.sqlite:table:key` with empty content — DELETE that row (destructive; double-check the key)
|
|
14
|
+
</instruction>
|
|
15
|
+
|
|
10
16
|
<critical>
|
|
11
17
|
- You SHOULD use Edit tool for modifying existing files (more precise, preserves formatting)
|
|
12
18
|
- You NEVER create documentation files (*.md, README) unless explicitly requested
|
package/src/sdk.ts
CHANGED
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
type AgentMessage,
|
|
5
5
|
type AgentTelemetryConfig,
|
|
6
6
|
type AgentTool,
|
|
7
|
-
AppendOnlyContextManager,
|
|
7
|
+
type AppendOnlyContextManager,
|
|
8
8
|
INTENT_FIELD,
|
|
9
9
|
type ThinkingLevel,
|
|
10
10
|
} from "@gajae-code/agent-core";
|
|
@@ -31,7 +31,11 @@ import {
|
|
|
31
31
|
prompt,
|
|
32
32
|
Snowflake,
|
|
33
33
|
} from "@gajae-code/utils";
|
|
34
|
-
|
|
34
|
+
import {
|
|
35
|
+
createAppendOnlyContextManager,
|
|
36
|
+
providerSupportsAppendOnlyAuto,
|
|
37
|
+
resolveAppendOnlyMode,
|
|
38
|
+
} from "./append-only-mode";
|
|
35
39
|
import { type AsyncJob, AsyncJobManager, isBackgroundJobSupportEnabled, jobElapsedMs } from "./async";
|
|
36
40
|
import { loadCapability } from "./capability";
|
|
37
41
|
import { type Rule, ruleCapability, setActiveRules } from "./capability/rule";
|
|
@@ -615,23 +619,12 @@ function registerJsVmCleanup(): void {
|
|
|
615
619
|
postmortem.register("js-vm-cleanup", disposeAllVmContexts);
|
|
616
620
|
}
|
|
617
621
|
|
|
618
|
-
|
|
619
|
-
*
|
|
620
|
-
*
|
|
621
|
-
*
|
|
622
|
-
* - `"off"` → never enable
|
|
623
|
-
* - `"auto"` → enable for DeepSeek (prefix-caching provider)
|
|
622
|
+
/*
|
|
623
|
+
* Append-only context-mode resolution + manager construction live in
|
|
624
|
+
* ./append-only-mode so the initial build, the runtime model/setting-change
|
|
625
|
+
* path, and the status UI share one implementation. Re-exported for importers/tests.
|
|
624
626
|
*/
|
|
625
|
-
|
|
626
|
-
switch (setting ?? "auto") {
|
|
627
|
-
case "on":
|
|
628
|
-
return true;
|
|
629
|
-
case "off":
|
|
630
|
-
return false;
|
|
631
|
-
default:
|
|
632
|
-
return provider === "deepseek";
|
|
633
|
-
}
|
|
634
|
-
}
|
|
627
|
+
export { createAppendOnlyContextManager, providerSupportsAppendOnlyAuto, resolveAppendOnlyMode };
|
|
635
628
|
|
|
636
629
|
function customToolToDefinition(tool: CustomTool): ToolDefinition {
|
|
637
630
|
const definition: ToolDefinition & { [TOOL_DEFINITION_MARKER]: true } = {
|
|
@@ -866,6 +859,10 @@ function withEmbeddedDefaultGjcSkills(skills: Skill[]): Skill[] {
|
|
|
866
859
|
return [...byName.values()];
|
|
867
860
|
}
|
|
868
861
|
|
|
862
|
+
export function resolveIntentTracingEnabled(intentTracingSetting: boolean | undefined, hasUI: boolean): boolean {
|
|
863
|
+
return (!!intentTracingSetting || $flag("PI_INTENT_TRACING")) && hasUI;
|
|
864
|
+
}
|
|
865
|
+
|
|
869
866
|
export async function createAgentSession(options: CreateAgentSessionOptions = {}): Promise<CreateAgentSessionResult> {
|
|
870
867
|
const cwd = options.cwd ?? getProjectDir();
|
|
871
868
|
const agentDir = options.agentDir ?? getDefaultAgentDir();
|
|
@@ -1125,8 +1122,15 @@ export async function createAgentSession(options: CreateAgentSessionOptions = {}
|
|
|
1125
1122
|
rulebookRules.push(rule);
|
|
1126
1123
|
}
|
|
1127
1124
|
}
|
|
1128
|
-
if (
|
|
1129
|
-
|
|
1125
|
+
if (ttsrManager.getSettings().enabled !== false) {
|
|
1126
|
+
if ((existingSession.ttsrMessageCount ?? 0) > 0) {
|
|
1127
|
+
ttsrManager.restoreMessageCount(existingSession.ttsrMessageCount ?? 0);
|
|
1128
|
+
}
|
|
1129
|
+
if (existingSession.injectedTtsrRuleRecords && existingSession.injectedTtsrRuleRecords.length > 0) {
|
|
1130
|
+
ttsrManager.restoreInjected(existingSession.injectedTtsrRuleRecords);
|
|
1131
|
+
} else if (existingSession.injectedTtsrRules.length > 0) {
|
|
1132
|
+
ttsrManager.restoreInjected(existingSession.injectedTtsrRules);
|
|
1133
|
+
}
|
|
1130
1134
|
}
|
|
1131
1135
|
return { ttsrManager, rulebookRules, alwaysApplyRules };
|
|
1132
1136
|
});
|
|
@@ -1765,7 +1769,11 @@ export async function createAgentSession(options: CreateAgentSessionOptions = {}
|
|
|
1765
1769
|
|
|
1766
1770
|
const repeatToolDescriptions = settings.get("repeatToolDescriptions");
|
|
1767
1771
|
const eagerTasks = settings.get("task.eager");
|
|
1768
|
-
const
|
|
1772
|
+
const intentTracingEnabled = resolveIntentTracingEnabled(
|
|
1773
|
+
settings.get("tools.intentTracing"),
|
|
1774
|
+
options.hasUI ?? false,
|
|
1775
|
+
);
|
|
1776
|
+
const intentField = intentTracingEnabled ? INTENT_FIELD : undefined;
|
|
1769
1777
|
const rebuildSystemPrompt = async (
|
|
1770
1778
|
toolNames: string[],
|
|
1771
1779
|
tools: Map<string, AgentTool>,
|
|
@@ -1837,6 +1845,7 @@ export async function createAgentSession(options: CreateAgentSessionOptions = {}
|
|
|
1837
1845
|
eagerTasks,
|
|
1838
1846
|
secretsEnabled,
|
|
1839
1847
|
workspaceTree: workspaceTreePromise,
|
|
1848
|
+
subagent: options.parentTaskPrefix !== undefined,
|
|
1840
1849
|
});
|
|
1841
1850
|
|
|
1842
1851
|
if (options.systemPrompt === undefined) {
|
|
@@ -2045,7 +2054,7 @@ export async function createAgentSession(options: CreateAgentSessionOptions = {}
|
|
|
2045
2054
|
|
|
2046
2055
|
const appendOnlyContext =
|
|
2047
2056
|
model && resolveAppendOnlyMode(settings.get("provider.appendOnlyContext"), model.provider)
|
|
2048
|
-
?
|
|
2057
|
+
? createAppendOnlyContextManager(model.provider)
|
|
2049
2058
|
: undefined;
|
|
2050
2059
|
if (appendOnlyContext && options.forkContextSeed && !hasExistingSession) {
|
|
2051
2060
|
if (options.forkContextSeed.appendOnlyPrefixSnapshot) {
|
|
@@ -2216,6 +2225,7 @@ export async function createAgentSession(options: CreateAgentSessionOptions = {}
|
|
|
2216
2225
|
onResponse,
|
|
2217
2226
|
convertToLlm: convertToLlmFinal,
|
|
2218
2227
|
rebuildSystemPrompt,
|
|
2228
|
+
workspaceTree: resolvedWorkspaceTree,
|
|
2219
2229
|
reloadSshTool,
|
|
2220
2230
|
requestedToolNames: requestedToolNameSet,
|
|
2221
2231
|
discoverableToolAllowedNames: options.discoverableToolAllowedNames,
|