@gajae-code/coding-agent 0.11.11 → 0.12.1
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 +131 -4
- package/dist/types/async/job-manager.d.ts +17 -3
- package/dist/types/cli/read-cli.d.ts +1 -0
- package/dist/types/commands/deep-interview.d.ts +9 -0
- package/dist/types/commands/harness.d.ts +22 -0
- package/dist/types/commands/read.d.ts +6 -0
- package/dist/types/config/model-registry.d.ts +4 -0
- package/dist/types/config/provider-auth-health.d.ts +14 -0
- package/dist/types/config/provider-ranking.d.ts +59 -0
- package/dist/types/config/settings-schema.d.ts +83 -1
- package/dist/types/config/settings.d.ts +2 -0
- package/dist/types/exa/mcp-client.d.ts +10 -1
- package/dist/types/exec/bash-executor.d.ts +45 -12
- package/dist/types/extensibility/extensions/types.d.ts +38 -4
- package/dist/types/extensibility/gjc-plugins/index.d.ts +12 -2
- package/dist/types/extensibility/gjc-plugins/installer.d.ts +63 -7
- package/dist/types/extensibility/gjc-plugins/lifecycle-reconciliation.d.ts +55 -0
- package/dist/types/extensibility/gjc-plugins/lifecycle.d.ts +64 -0
- package/dist/types/extensibility/gjc-plugins/runtime-quarantine.d.ts +67 -0
- package/dist/types/extensibility/gjc-plugins/session-validation.d.ts +3 -1
- package/dist/types/extensibility/gjc-plugins/types.d.ts +124 -0
- package/dist/types/extensibility/shared-events.d.ts +6 -0
- package/dist/types/gjc-runtime/deep-interview-ambiguity.d.ts +5 -12
- package/dist/types/gjc-runtime/deep-interview-recorder.d.ts +17 -32
- package/dist/types/gjc-runtime/deep-interview-stage.d.ts +37 -0
- package/dist/types/gjc-runtime/deep-interview-state.d.ts +4 -135
- package/dist/types/gjc-runtime/gc-runtime.d.ts +1 -1
- package/dist/types/gjc-runtime/launch-tmux.d.ts +1 -0
- package/dist/types/gjc-runtime/memory-guard-owner-claims.d.ts +47 -0
- package/dist/types/gjc-runtime/ralplan-runtime.d.ts +70 -1
- package/dist/types/gjc-runtime/state-writer.d.ts +5 -46
- package/dist/types/gjc-runtime/team-launch.d.ts +1 -1
- package/dist/types/gjc-runtime/team-runtime.d.ts +27 -1
- package/dist/types/gjc-runtime/team-store.d.ts +12 -0
- package/dist/types/gjc-runtime/team-worker-heartbeat.d.ts +43 -0
- package/dist/types/gjc-runtime/team-worker-memory-guard.d.ts +92 -0
- package/dist/types/gjc-runtime/tmux-owner-isolation.d.ts +17 -0
- package/dist/types/gjc-runtime/ultragoal-receipt-freshness.d.ts +8 -0
- package/dist/types/gjc-runtime/ultragoal-runtime.d.ts +31 -80
- package/dist/types/gjc-runtime/workflow-manifest.d.ts +3 -5
- package/dist/types/internal-urls/local-root-gc.d.ts +2 -0
- package/dist/types/main.d.ts +1 -1
- package/dist/types/memories/index.d.ts +2 -0
- package/dist/types/modes/acp/acp-agent.d.ts +10 -19
- package/dist/types/modes/components/assistant-message.d.ts +3 -1
- package/dist/types/modes/components/gjc-bundle-settings.d.ts +34 -0
- package/dist/types/modes/components/irc-sidebar.d.ts +41 -0
- package/dist/types/modes/components/notifications-settings-editor.d.ts +1 -0
- package/dist/types/modes/components/read-tool-group.d.ts +4 -4
- package/dist/types/modes/components/session-observer-overlay.d.ts +22 -0
- package/dist/types/modes/components/settings-selector.d.ts +11 -0
- package/dist/types/modes/components/status-line/gh.d.ts +5 -0
- package/dist/types/modes/components/tool-execution.d.ts +8 -0
- package/dist/types/modes/components/transcript-viewer-overlay.d.ts +18 -1
- package/dist/types/modes/controllers/event-controller.d.ts +3 -0
- package/dist/types/modes/interactive-mode.d.ts +2 -0
- package/dist/types/modes/irc-observation-ledger.d.ts +17 -1
- package/dist/types/modes/types.d.ts +2 -0
- package/dist/types/modes/utils/ui-helpers.d.ts +16 -0
- package/dist/types/reminders/star-reminder.d.ts +3 -13
- package/dist/types/runtime-mcp/manager.d.ts +1 -0
- package/dist/types/runtime-mcp/smithery-auth.d.ts +5 -0
- package/dist/types/sdk/acp/adapter.d.ts +3 -1
- package/dist/types/sdk/broker/lifecycle.d.ts +5 -0
- package/dist/types/sdk/broker/transport.d.ts +2 -0
- package/dist/types/sdk/bus/attachment-registry.d.ts +1 -0
- package/dist/types/sdk/bus/chat-daemon-control.d.ts +4 -1
- package/dist/types/sdk/bus/config.d.ts +6 -2
- package/dist/types/sdk/bus/control-drain-lease.d.ts +52 -0
- package/dist/types/sdk/bus/index.d.ts +44 -1
- package/dist/types/sdk/bus/kind-aware-reconciliation.d.ts +44 -0
- package/dist/types/sdk/bus/lifecycle-control-runtime.d.ts +4 -0
- package/dist/types/sdk/bus/prompt-reconciliation.d.ts +2 -1
- package/dist/types/sdk/bus/reconciliation-store.d.ts +69 -0
- package/dist/types/sdk/bus/rich-draft.d.ts +1 -0
- package/dist/types/sdk/bus/rich-render.d.ts +2 -0
- package/dist/types/sdk/bus/telegram-adoption-intent.d.ts +165 -0
- package/dist/types/sdk/bus/telegram-cli.d.ts +12 -0
- package/dist/types/sdk/bus/telegram-daemon-contract.d.ts +11 -4
- package/dist/types/sdk/bus/telegram-daemon.d.ts +25 -1
- package/dist/types/sdk/bus/telegram-reference.d.ts +11 -1
- package/dist/types/sdk/bus/threaded-render.d.ts +3 -2
- package/dist/types/sdk/bus/topic-registry.d.ts +11 -1
- package/dist/types/sdk/host/control/operations.d.ts +1 -1
- package/dist/types/sdk/host/host.d.ts +2 -0
- package/dist/types/sdk/host/query/handlers.d.ts +5 -0
- package/dist/types/sdk/host/query/revision-store.d.ts +2 -0
- package/dist/types/sdk/host/reverse-leases.d.ts +1 -1
- package/dist/types/sdk/prompt-status.d.ts +23 -3
- package/dist/types/sdk/session.d.ts +6 -0
- package/dist/types/session/agent-session.d.ts +82 -12
- package/dist/types/session/artifacts.d.ts +8 -0
- package/dist/types/session/blob-store.d.ts +57 -4
- package/dist/types/session/internal/managed-session-storage.d.ts +8 -1
- package/dist/types/session/memory-guard-checkpoint-participant.d.ts +69 -0
- package/dist/types/session/session-manager.d.ts +48 -19
- package/dist/types/session/session-storage.d.ts +4 -0
- package/dist/types/session/streaming-output.d.ts +96 -12
- package/dist/types/setup/credential-import.d.ts +12 -0
- package/dist/types/skill-state/active-state.d.ts +12 -4
- package/dist/types/skill-state/workflow-hud.d.ts +9 -0
- package/dist/types/task/executor.d.ts +3 -2
- package/dist/types/task/index.d.ts +3 -1
- package/dist/types/task/provider-retry-status.d.ts +8 -0
- package/dist/types/task/receipt.d.ts +7 -1
- package/dist/types/task/types.d.ts +23 -0
- package/dist/types/tools/ask-answer-registry.d.ts +2 -2
- package/dist/types/tools/bash-interactive.d.ts +4 -1
- package/dist/types/tools/bash.d.ts +3 -1
- package/dist/types/tools/browser/launch.d.ts +7 -0
- package/dist/types/tools/fetch.d.ts +17 -1
- package/dist/types/tools/image-gen.d.ts +4 -0
- package/dist/types/tools/index.d.ts +4 -0
- package/dist/types/tools/output-meta.d.ts +44 -3
- package/dist/types/tools/path-utils.d.ts +1 -0
- package/dist/types/tools/read-internals.d.ts +12 -0
- package/dist/types/tools/read.d.ts +45 -7
- package/dist/types/tools/resource-gc.d.ts +4 -0
- package/dist/types/tools/review.d.ts +5 -7
- package/dist/types/tools/subagent.d.ts +2 -0
- package/dist/types/tools/tool-result.d.ts +7 -1
- package/dist/types/utils/gh.d.ts +13 -0
- package/dist/types/utils/image-resize.d.ts +1 -0
- package/dist/types/web/search/providers/kimi.d.ts +2 -0
- package/dist/types/web/search/providers/searxng.d.ts +7 -0
- package/dist/types/web/search/providers/xai.d.ts +2 -0
- package/package.json +11 -13
- package/scripts/acp-conformance-agent.ts +218 -0
- package/scripts/benchmark-sticky-viewport-pr1.ts +239 -0
- package/scripts/capture-gjc-bundle-settings.ts +306 -0
- package/scripts/capture-sticky-viewport-showcase.ts +292 -0
- package/scripts/generate-sdk-operation-inventory.ts +5 -0
- package/scripts/resident-memory-bench.ts +1341 -0
- package/scripts/run-acp-conformance.ts +285 -0
- package/scripts/verify-gjc-sdk-canonicalization.ts +122 -18
- package/scripts/verify-sticky-viewport-showcase.ts +611 -0
- package/src/async/job-manager.ts +78 -20
- package/src/capability/index.ts +8 -0
- package/src/cli/fast-help.ts +1 -1
- package/src/cli/plugin-cli.ts +176 -18
- package/src/cli/read-cli.ts +2 -1
- package/src/cli.ts +1 -0
- package/src/commands/deep-interview.ts +29 -9
- package/src/commands/harness.ts +35 -12
- package/src/commands/read.ts +11 -2
- package/src/commands/team.ts +20 -2
- package/src/config/file-lock.ts +11 -2
- package/src/config/model-registry.ts +21 -2
- package/src/config/provider-auth-health.ts +42 -0
- package/src/config/provider-ranking.ts +119 -0
- package/src/config/settings-schema.ts +74 -1
- package/src/config/settings.ts +246 -108
- package/src/coordinator-mcp/question-gate-codec.ts +1 -1
- package/src/coordinator-mcp/server.ts +5 -12
- package/src/defaults/gjc/skills/deep-interview/SKILL.md +230 -82
- package/src/defaults/gjc/skills/ralplan/SKILL.md +77 -41
- package/src/defaults/gjc/skills/team/SKILL.md +3 -1
- package/src/defaults/gjc/skills/ultragoal/SKILL.md +62 -39
- package/src/defaults/gjc/skills/ultragoal/validation-batch-contracts.md +12 -0
- package/src/defaults/gjc-defaults.ts +4 -4
- package/src/eval/py/executor.ts +7 -2
- package/src/exa/mcp-client.ts +12 -3
- package/src/exec/bash-executor.ts +144 -27
- package/src/extensibility/extensions/runner.ts +15 -0
- package/src/extensibility/extensions/types.ts +46 -5
- package/src/extensibility/gjc-plugins/constrained-hooks.ts +8 -2
- package/src/extensibility/gjc-plugins/index.ts +19 -2
- package/src/extensibility/gjc-plugins/installer.ts +189 -50
- package/src/extensibility/gjc-plugins/lifecycle-reconciliation.ts +199 -0
- package/src/extensibility/gjc-plugins/lifecycle.ts +626 -0
- package/src/extensibility/gjc-plugins/observability.ts +3 -3
- package/src/extensibility/gjc-plugins/prompt-appendix.ts +5 -1
- package/src/extensibility/gjc-plugins/runtime-adapters.ts +12 -2
- package/src/extensibility/gjc-plugins/runtime-quarantine.ts +121 -0
- package/src/extensibility/gjc-plugins/schema.ts +84 -12
- package/src/extensibility/gjc-plugins/session-validation.ts +9 -3
- package/src/extensibility/gjc-plugins/types.ts +141 -0
- package/src/extensibility/gjc-plugins/validation.ts +9 -0
- package/src/extensibility/shared-events.ts +5 -0
- package/src/gjc-runtime/deep-interview-ambiguity.ts +47 -82
- package/src/gjc-runtime/deep-interview-recorder.ts +227 -310
- package/src/gjc-runtime/deep-interview-runtime.ts +109 -270
- package/src/gjc-runtime/deep-interview-stage.ts +1016 -0
- package/src/gjc-runtime/deep-interview-state.ts +12 -943
- package/src/gjc-runtime/gc-render.ts +1 -0
- package/src/gjc-runtime/gc-runtime.ts +11 -1
- package/src/gjc-runtime/launch-tmux.ts +25 -6
- package/src/gjc-runtime/managed-owner-admission.ts +1 -1
- package/src/gjc-runtime/memory-guard-owner-claims.ts +389 -0
- package/src/gjc-runtime/ralplan-runtime.ts +1149 -98
- package/src/gjc-runtime/state-runtime.ts +2 -1
- package/src/gjc-runtime/state-writer.ts +70 -222
- package/src/gjc-runtime/team-launch.ts +42 -5
- package/src/gjc-runtime/team-runtime.ts +1085 -40
- package/src/gjc-runtime/team-store.ts +32 -0
- package/src/gjc-runtime/team-worker-heartbeat.ts +149 -0
- package/src/gjc-runtime/team-worker-memory-guard.ts +363 -0
- package/src/gjc-runtime/team-workers.ts +1 -0
- package/src/gjc-runtime/tmux-owner-isolation.ts +28 -0
- package/src/gjc-runtime/tmux-sessions.ts +58 -13
- package/src/gjc-runtime/ultragoal-receipt-freshness.ts +20 -0
- package/src/gjc-runtime/ultragoal-runtime.ts +414 -618
- package/src/gjc-runtime/workflow-manifest.generated.json +105 -449
- package/src/gjc-runtime/workflow-manifest.ts +38 -247
- package/src/hooks/native-skill-hook.ts +17 -4
- package/src/hooks/skill-state.ts +1 -23
- package/src/internal-urls/docs-index.generated.ts +21 -22
- package/src/internal-urls/local-root-gc.ts +127 -0
- package/src/main.ts +9 -5
- package/src/memories/index.ts +10 -0
- package/src/modes/DESIGN.md +98 -0
- package/src/modes/acp/acp-agent.ts +339 -191
- package/src/modes/acp/acp-event-mapper.ts +14 -7
- package/src/modes/acp/acp-mode.ts +39 -3
- package/src/modes/components/assistant-message.ts +123 -22
- package/src/modes/components/gjc-bundle-settings.ts +508 -0
- package/src/modes/components/irc-sidebar.ts +176 -62
- package/src/modes/components/model-selector.ts +61 -4
- package/src/modes/components/notifications-settings-editor.ts +12 -1
- package/src/modes/components/oauth-selector.ts +96 -28
- package/src/modes/components/read-tool-group.ts +82 -14
- package/src/modes/components/session-observer-overlay.ts +457 -83
- package/src/modes/components/settings-selector.ts +116 -23
- package/src/modes/components/status-line/gh.ts +16 -0
- package/src/modes/components/tool-execution.ts +138 -27
- package/src/modes/components/tool-status-header.ts +3 -14
- package/src/modes/components/transcript-viewer-overlay.ts +99 -24
- package/src/modes/controllers/command-controller.ts +4 -0
- package/src/modes/controllers/event-controller.ts +109 -27
- package/src/modes/controllers/extension-ui-controller.ts +26 -2
- package/src/modes/controllers/input-controller.ts +18 -3
- package/src/modes/controllers/selector-controller.ts +127 -36
- package/src/modes/interactive-mode.ts +62 -3
- package/src/modes/irc-observation-ledger.ts +71 -15
- package/src/modes/runtime-init.ts +22 -2
- package/src/modes/types.ts +2 -0
- package/src/modes/utils/ui-helpers.ts +94 -1
- package/src/prompts/agent-fragments/ralplan-persistence.md +4 -3
- package/src/prompts/agents/architect.md +9 -1
- package/src/prompts/agents/critic.md +9 -0
- package/src/prompts/system/eager-todo.md +8 -4
- package/src/prompts/system/system-prompt.md +11 -5
- package/src/prompts/tools/bash.md +5 -5
- package/src/prompts/tools/read.md +4 -2
- package/src/prompts/tools/search-tool-bm25.md +5 -0
- package/src/prompts/tools/task.md +1 -1
- package/src/reminders/star-reminder.ts +4 -42
- package/src/runtime-mcp/manager.ts +19 -4
- package/src/runtime-mcp/smithery-auth.ts +17 -2
- package/src/runtime-mcp/smithery-connect.ts +11 -1
- package/src/sdk/acp/adapter.ts +22 -6
- package/src/sdk/broker/lifecycle.ts +25 -6
- package/src/sdk/broker/transport.ts +35 -3
- package/src/sdk/bus/attachment-registry.ts +5 -1
- package/src/sdk/bus/chat-daemon-cli.ts +4 -39
- package/src/sdk/bus/chat-daemon-control.ts +6 -3
- package/src/sdk/bus/config.ts +18 -2
- package/src/sdk/bus/control-drain-lease.ts +104 -0
- package/src/sdk/bus/index.ts +984 -146
- package/src/sdk/bus/kind-aware-reconciliation.ts +317 -0
- package/src/sdk/bus/lifecycle-commands.ts +4 -1
- package/src/sdk/bus/lifecycle-control-runtime.ts +403 -88
- package/src/sdk/bus/prompt-reconciliation.ts +2 -1
- package/src/sdk/bus/reconciliation-store.ts +303 -0
- package/src/sdk/bus/rich-draft.ts +1 -1
- package/src/sdk/bus/rich-render.ts +2 -2
- package/src/sdk/bus/telegram-adoption-intent.ts +574 -0
- package/src/sdk/bus/telegram-cli.ts +33 -8
- package/src/sdk/bus/telegram-daemon-cli.ts +1 -0
- package/src/sdk/bus/telegram-daemon-contract.ts +11 -4
- package/src/sdk/bus/telegram-daemon.ts +916 -23
- package/src/sdk/bus/telegram-reference.ts +40 -3
- package/src/sdk/bus/threaded-render.ts +48 -3
- package/src/sdk/bus/topic-registry.ts +20 -0
- package/src/sdk/host/control/dispatch.ts +5 -1
- package/src/sdk/host/control/operations.ts +1 -1
- package/src/sdk/host/host.ts +23 -1
- package/src/sdk/host/query/handlers.ts +55 -0
- package/src/sdk/host/query/revision-store.ts +36 -2
- package/src/sdk/host/reverse-leases.ts +44 -7
- package/src/sdk/mcp/server.ts +46 -18
- package/src/sdk/prompt-status.ts +16 -3
- package/src/sdk/protocol/operation-inventory.generated.json +51 -0
- package/src/sdk/protocol/operation-registry.ts +7 -2
- package/src/sdk/session.ts +101 -10
- package/src/session/agent-session.ts +1286 -220
- package/src/session/artifacts.ts +22 -0
- package/src/session/auth-broker-config.ts +10 -3
- package/src/session/blob-store.ts +915 -24
- package/src/session/internal/managed-session-scope.ts +44 -6
- package/src/session/internal/managed-session-storage.ts +48 -6
- package/src/session/memory-guard-checkpoint-participant.ts +131 -0
- package/src/session/session-manager.ts +2364 -438
- package/src/session/session-storage.ts +9 -1
- package/src/session/streaming-output.ts +500 -111
- package/src/setup/credential-import.ts +75 -13
- package/src/setup/provider-onboarding.ts +19 -4
- package/src/skill-state/active-state.ts +32 -10
- package/src/skill-state/workflow-hud.ts +42 -2
- package/src/skill-state/workflow-mutation-guard.ts +560 -8
- package/src/task/executor.ts +122 -39
- package/src/task/index.ts +23 -14
- package/src/task/provider-retry-status.ts +16 -0
- package/src/task/receipt.ts +23 -7
- package/src/task/render.ts +6 -2
- package/src/task/types.ts +108 -0
- package/src/tools/ask-answer-registry.ts +12 -6
- package/src/tools/ask.ts +169 -118
- package/src/tools/ast-edit.ts +1 -0
- package/src/tools/ast-grep.ts +1 -0
- package/src/tools/bash-interactive.ts +8 -3
- package/src/tools/bash.ts +503 -60
- package/src/tools/browser/launch.ts +41 -6
- package/src/tools/fetch.ts +114 -23
- package/src/tools/find.ts +1 -0
- package/src/tools/image-gen.ts +29 -5
- package/src/tools/index.ts +4 -0
- package/src/tools/output-meta.ts +281 -20
- package/src/tools/path-utils.ts +8 -3
- package/src/tools/read-internals.ts +44 -0
- package/src/tools/read.ts +1560 -310
- package/src/tools/resource-gc.ts +182 -18
- package/src/tools/review.ts +5 -7
- package/src/tools/search.ts +1 -0
- package/src/tools/subagent-render.ts +6 -2
- package/src/tools/subagent.ts +6 -0
- package/src/tools/telegram-send.ts +6 -3
- package/src/tools/tool-result.ts +14 -1
- package/src/utils/gh.ts +39 -0
- package/src/utils/image-resize.ts +3 -0
- package/src/web/search/providers/anthropic.ts +4 -4
- package/src/web/search/providers/codex.ts +1 -1
- package/src/web/search/providers/kimi.ts +15 -5
- package/src/web/search/providers/searxng.ts +47 -4
- package/src/web/search/providers/xai.ts +7 -2
- package/dist/types/gjc-runtime/deep-interview-draft.d.ts +0 -8
- package/dist/types/gjc-runtime/deep-interview-payload.d.ts +0 -41
- package/dist/types/gjc-runtime/deep-interview-repair.d.ts +0 -17
- package/dist/types/gjc-runtime/ultragoal-pipeline.d.ts +0 -23
- package/src/defaults/gjc/skills/ultragoal/pipeline-validation-contracts.md +0 -30
- package/src/gjc-runtime/deep-interview-draft.ts +0 -843
- package/src/gjc-runtime/deep-interview-payload.ts +0 -262
- package/src/gjc-runtime/deep-interview-repair.ts +0 -1674
- package/src/gjc-runtime/ultragoal-pipeline.ts +0 -306
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type { PromptReconciliationStatus, SdkPromptTerminalOutcome } from "../prompt-status";
|
|
2
|
+
import type { PromptCorrelation } from "./prompt-reconciliation";
|
|
3
|
+
export declare const RECONCILIATION_STORE_VERSION = 1;
|
|
4
|
+
export declare const RECONCILIATION_SESSION_ID_PATTERN: RegExp;
|
|
5
|
+
export declare const RECONCILIATION_DIR_NAME = ".sdk-reconciliation";
|
|
6
|
+
export type ReconciliationKind = "prompt" | "skill";
|
|
7
|
+
export interface DurableReconciliationRecord extends PromptCorrelation {
|
|
8
|
+
kind: ReconciliationKind;
|
|
9
|
+
clientRef?: string;
|
|
10
|
+
status: PromptReconciliationStatus;
|
|
11
|
+
error?: {
|
|
12
|
+
code: string;
|
|
13
|
+
message: string;
|
|
14
|
+
};
|
|
15
|
+
acceptedAt: number;
|
|
16
|
+
startedAt?: number;
|
|
17
|
+
terminalAt?: number;
|
|
18
|
+
outcome?: SdkPromptTerminalOutcome;
|
|
19
|
+
pendingOutcome?: SdkPromptTerminalOutcome;
|
|
20
|
+
/** Skill-only safe token; never skill args bodies. */
|
|
21
|
+
skillName?: string;
|
|
22
|
+
}
|
|
23
|
+
export interface ReconciliationStoreDocument {
|
|
24
|
+
version: typeof RECONCILIATION_STORE_VERSION;
|
|
25
|
+
sessionId: string;
|
|
26
|
+
records: DurableReconciliationRecord[];
|
|
27
|
+
}
|
|
28
|
+
export interface ReconciliationStoreFs {
|
|
29
|
+
mkdir(directory: string, options: {
|
|
30
|
+
recursive: true;
|
|
31
|
+
mode: number;
|
|
32
|
+
}): Promise<unknown>;
|
|
33
|
+
readFile(file: string, encoding: "utf8"): Promise<string>;
|
|
34
|
+
writeFile(file: string, data: string, options: {
|
|
35
|
+
mode: number;
|
|
36
|
+
}): Promise<void>;
|
|
37
|
+
rename(from: string, to: string): Promise<void>;
|
|
38
|
+
unlink(file: string): Promise<void>;
|
|
39
|
+
open(file: string, flags: string): Promise<{
|
|
40
|
+
sync(): Promise<void>;
|
|
41
|
+
close(): Promise<void>;
|
|
42
|
+
writeFile(data: string, encoding: "utf8"): Promise<void>;
|
|
43
|
+
}>;
|
|
44
|
+
}
|
|
45
|
+
export declare function isSafeReconciliationSessionId(sessionId: string): boolean;
|
|
46
|
+
/** Derive private store path; throws if sessionId is unsafe (path escape). */
|
|
47
|
+
export declare function reconciliationStorePath(sessionFile: string, sessionId: string): string;
|
|
48
|
+
/**
|
|
49
|
+
* Settle non-terminal durable records after process death.
|
|
50
|
+
* Prompt records preserve a durable pending outcome; skills retain the existing
|
|
51
|
+
* reconciliation-incomplete result.
|
|
52
|
+
*/
|
|
53
|
+
export declare function settleProcessRestart(records: DurableReconciliationRecord[], now: number): DurableReconciliationRecord[];
|
|
54
|
+
export interface ReconciliationStore {
|
|
55
|
+
readonly path: string | null;
|
|
56
|
+
readonly sessionId: string;
|
|
57
|
+
/** Serialize mutations; reload not required for single-process host (in-memory + write). */
|
|
58
|
+
transact(mutator: (records: DurableReconciliationRecord[]) => DurableReconciliationRecord[]): Promise<void>;
|
|
59
|
+
load(): Promise<DurableReconciliationRecord[]>;
|
|
60
|
+
/** Snapshot currently held in memory after last load/transact. */
|
|
61
|
+
snapshot(): DurableReconciliationRecord[];
|
|
62
|
+
delete(): Promise<void>;
|
|
63
|
+
}
|
|
64
|
+
export declare function createReconciliationStore(options: {
|
|
65
|
+
sessionFile: string | null | undefined;
|
|
66
|
+
sessionId: string;
|
|
67
|
+
fs?: ReconciliationStoreFs;
|
|
68
|
+
now?: () => number;
|
|
69
|
+
}): ReconciliationStore;
|
|
@@ -63,6 +63,7 @@ export declare class DraftStreamState {
|
|
|
63
63
|
export declare function deliverDraft(botApi: BotApi, base: {
|
|
64
64
|
chat_id: string | number;
|
|
65
65
|
message_thread_id?: number;
|
|
66
|
+
disable_notification?: true;
|
|
66
67
|
}, draftId: number, raw: string, log?: {
|
|
67
68
|
warn(msg: string): void;
|
|
68
69
|
}): Promise<void>;
|
|
@@ -43,6 +43,7 @@ export declare function shouldPromoteRich(input: {
|
|
|
43
43
|
export declare function deliverRichWithFallback(botApi: BotApi, base: {
|
|
44
44
|
chat_id: string | number;
|
|
45
45
|
message_thread_id?: number;
|
|
46
|
+
disable_notification?: true;
|
|
46
47
|
}, send: ThreadedSend, signal: AbortSignal, fallbackDeliver: () => Promise<void>, log?: {
|
|
47
48
|
warn(msg: string): void;
|
|
48
49
|
}): Promise<number | undefined>;
|
|
@@ -55,6 +56,7 @@ export declare function deliverRichWithFallback(botApi: BotApi, base: {
|
|
|
55
56
|
export declare function deliverRichActionWithFallback(botApi: BotApi, base: {
|
|
56
57
|
chat_id: string | number;
|
|
57
58
|
message_thread_id?: number;
|
|
59
|
+
disable_notification?: true;
|
|
58
60
|
}, opts: {
|
|
59
61
|
markdown: string;
|
|
60
62
|
replyMarkup?: unknown;
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Durable, non-routable sidecar store for "adopt a user-created Telegram forum
|
|
3
|
+
* topic into a preallocated session" intents.
|
|
4
|
+
*
|
|
5
|
+
* When a user creates a new forum topic, the daemon first records durable
|
|
6
|
+
* pending-topic authorization. After folder selection it preallocates an
|
|
7
|
+
* `intendedSessionId` and records an adoption intent here *before* spawning.
|
|
8
|
+
* Later, the authenticated `ensureTopic` create callback reads that intent and
|
|
9
|
+
* returns the user's existing topicId to `TopicRegistry.getOrCreateTopic`, which
|
|
10
|
+
* is the only authority that commits a topic binding. This keeps the intent out
|
|
11
|
+
* of routing/endpoint authority until commit, so a failed spawn or a late socket
|
|
12
|
+
* never deletes the user's topic and never strands a duplicate.
|
|
13
|
+
*
|
|
14
|
+
* Invariants (see `pending-approval.md`):
|
|
15
|
+
* - One file per intent, named `<intendedSessionId>.adoption-intent.json` under
|
|
16
|
+
* the daemon notifications dir. Sweep touches files only; never the Telegram API.
|
|
17
|
+
* - Only `{ intendedSessionId, topicId, chatId, target, createdAt, expiresAt }`
|
|
18
|
+
* is persisted. Bot/control tokens and endpoint digests are never stored.
|
|
19
|
+
* - Owner-only dir (0o700) and 0o600 files; atomic temp→fsync→chmod→rename→parent sync.
|
|
20
|
+
* - `tryClaim` is a synchronous, in-memory claim keyed by topicId; it excludes a
|
|
21
|
+
* second `intendedSessionId` from winning the same topic across awaits. It
|
|
22
|
+
* does not delete the sidecar; `releaseClaim` re-enables retry on commit failure.
|
|
23
|
+
*/
|
|
24
|
+
import type { SessionCreateTarget } from "./index";
|
|
25
|
+
/** Persisted document version. */
|
|
26
|
+
export declare const TELEGRAM_ADOPTION_INTENT_VERSION = 1;
|
|
27
|
+
export type TelegramAdoptionTarget = Extract<SessionCreateTarget, {
|
|
28
|
+
kind: "existing_path";
|
|
29
|
+
}>;
|
|
30
|
+
/** Default intent TTL (configurable at write time). Plan starts at 10 minutes. */
|
|
31
|
+
export declare const DEFAULT_ADOPTION_INTENT_TTL_MS: number;
|
|
32
|
+
/**
|
|
33
|
+
* Minimal async filesystem surface the store needs. Structurally a subset of the
|
|
34
|
+
* daemon's `TelegramDaemonFs` / `ConversationStoreFs`, so the daemon can pass its
|
|
35
|
+
* own `fs` straight through and tests can inject a fake. `open`/`sync`/`close`
|
|
36
|
+
* mirror `ConversationStoreFileHandle` so the atomic fsync path reuses the same
|
|
37
|
+
* shape as the conversation store.
|
|
38
|
+
*/
|
|
39
|
+
export interface AdoptionIntentFs {
|
|
40
|
+
mkdir(directory: string, options: {
|
|
41
|
+
recursive: true;
|
|
42
|
+
mode: number;
|
|
43
|
+
}): Promise<unknown>;
|
|
44
|
+
chmod(target: string, mode: number): Promise<void>;
|
|
45
|
+
readFile(file: string, encoding: "utf8"): Promise<string>;
|
|
46
|
+
writeFile(file: string, data: string, options: {
|
|
47
|
+
mode: number;
|
|
48
|
+
}): Promise<void>;
|
|
49
|
+
rename(from: string, to: string): Promise<void>;
|
|
50
|
+
unlink(file: string): Promise<unknown>;
|
|
51
|
+
readdir(directory: string): Promise<readonly string[]>;
|
|
52
|
+
open(file: string, flags: string): Promise<AdoptionIntentFileHandle>;
|
|
53
|
+
}
|
|
54
|
+
export interface AdoptionIntentFileHandle {
|
|
55
|
+
sync(): Promise<void>;
|
|
56
|
+
close(): Promise<void>;
|
|
57
|
+
}
|
|
58
|
+
/** What gets persisted per intent. No tokens, no digests. */
|
|
59
|
+
export interface TelegramAdoptionIntent {
|
|
60
|
+
intendedSessionId: string;
|
|
61
|
+
topicId: number;
|
|
62
|
+
chatId: string;
|
|
63
|
+
target: TelegramAdoptionTarget;
|
|
64
|
+
createdAt: number;
|
|
65
|
+
expiresAt: number;
|
|
66
|
+
}
|
|
67
|
+
/** Durable authorization that a topic was observed through forum_topic_created. */
|
|
68
|
+
export interface TelegramPendingTopic {
|
|
69
|
+
topicId: number;
|
|
70
|
+
chatId: string;
|
|
71
|
+
createdAt: number;
|
|
72
|
+
expiresAt: number;
|
|
73
|
+
}
|
|
74
|
+
/** Compose the per-intent sidecar path. Public so callers/tests can inspect it. */
|
|
75
|
+
export declare function adoptionIntentFilePath(agentDir: string, intendedSessionId: string): string;
|
|
76
|
+
/** Compose the sidecar path for a user-created topic awaiting a folder choice. */
|
|
77
|
+
export declare function pendingTopicFilePath(agentDir: string, topicId: number): string;
|
|
78
|
+
/** Build a fresh intent with `createdAt`/`expiresAt` derived from `now`/`ttlMs`. */
|
|
79
|
+
export declare function buildAdoptionIntent(input: {
|
|
80
|
+
intendedSessionId: string;
|
|
81
|
+
topicId: number;
|
|
82
|
+
chatId: string;
|
|
83
|
+
target: TelegramAdoptionTarget;
|
|
84
|
+
now?: number;
|
|
85
|
+
ttlMs?: number;
|
|
86
|
+
}): TelegramAdoptionIntent;
|
|
87
|
+
/** Test-only: filename suffix used to recognize intent sidecars in a directory listing. */
|
|
88
|
+
export declare const ADOPTION_INTENT_FILENAME_SUFFIX = ".adoption-intent.json";
|
|
89
|
+
export declare const PENDING_TOPIC_FILENAME_SUFFIX = ".pending-topic.json";
|
|
90
|
+
/**
|
|
91
|
+
* Durable, non-routable adoption-intent store. Owns durable sidecar files and
|
|
92
|
+
* the synchronous in-memory topicId claim table. The daemon owns Telegram and
|
|
93
|
+
* lifecycle wiring; this store never calls the Telegram API.
|
|
94
|
+
*/
|
|
95
|
+
export declare class TelegramAdoptionIntentStore {
|
|
96
|
+
#private;
|
|
97
|
+
constructor(input: {
|
|
98
|
+
agentDir: string;
|
|
99
|
+
fs?: AdoptionIntentFs;
|
|
100
|
+
now?: () => number;
|
|
101
|
+
platform?: NodeJS.Platform;
|
|
102
|
+
});
|
|
103
|
+
/** Directory holding the sidecar files. */
|
|
104
|
+
get directory(): string;
|
|
105
|
+
/** In-memory lookup by intendedSessionId (no disk read). undefined if absent/expired. */
|
|
106
|
+
bySession(intendedSessionId: string): TelegramAdoptionIntent | undefined;
|
|
107
|
+
/** In-memory lookup of the (single) non-expired intent for a topicId. */
|
|
108
|
+
byTopic(topicId: number): TelegramAdoptionIntent | undefined;
|
|
109
|
+
/** `true` if a non-expired intent already references `topicId`. */
|
|
110
|
+
hasNonExpiredTopic(topicId: number): boolean;
|
|
111
|
+
/** Durable authorization for an observed user-created topic, if still live. */
|
|
112
|
+
pendingTopic(topicId: number): TelegramPendingTopic | undefined;
|
|
113
|
+
hasPendingTopic(topicId: number, chatId: string): boolean;
|
|
114
|
+
/**
|
|
115
|
+
* Synchronously claim `topicId` for `intendedSessionId`. Returns false if a
|
|
116
|
+
* *different* non-expired intendedSessionId already holds the claim (or has a
|
|
117
|
+
* non-expired intent for the topic). Same intendedSessionId re-claiming its
|
|
118
|
+
* own topic is idempotent and succeeds. The claim is in-memory only; it never
|
|
119
|
+
* deletes the sidecar, so a commit failure can `releaseClaim` and retry.
|
|
120
|
+
*/
|
|
121
|
+
tryClaim(topicId: number, intendedSessionId: string): boolean;
|
|
122
|
+
/** Release a claim held by `intendedSessionId` on `topicId`. No-op otherwise. */
|
|
123
|
+
releaseClaim(topicId: number, intendedSessionId: string): void;
|
|
124
|
+
/**
|
|
125
|
+
* Durable write of one intent: temp→write→fsync→chmod(0600)→atomic rename→
|
|
126
|
+
* chmod(final, 0600)→parent-dir fsync, then track it in memory. The dir is
|
|
127
|
+
* created owner-only (0700). chmod-ing the final path after the rename makes
|
|
128
|
+
* the 0600 contract durable regardless of whether the platform's rename
|
|
129
|
+
* preserves the source mode (POSIX does; some test/network filesystems and
|
|
130
|
+
* the in-memory test double model rename as copy+delete and would otherwise
|
|
131
|
+
* drop it). The rename is still the atomic commit point; the final chmod only
|
|
132
|
+
* tightens permissions on the already-durable file. The in-memory map is only
|
|
133
|
+
* mutated after the atomic persist succeeds. Rejects (does not swallow) so the
|
|
134
|
+
* daemon can decide fail-closed behavior.
|
|
135
|
+
*/
|
|
136
|
+
put(intent: TelegramAdoptionIntent): Promise<void>;
|
|
137
|
+
/** Persist authorization for a topic observed through forum_topic_created. */
|
|
138
|
+
putPendingTopic(pendingTopic: TelegramPendingTopic): Promise<void>;
|
|
139
|
+
/**
|
|
140
|
+
* Read a single intent sidecar from disk and track it if it is non-expired
|
|
141
|
+
* and well-formed. Returns the parsed intent (or undefined). Used by
|
|
142
|
+
* `rehydrate`; callers normally use `rehydrate` / `bySession`.
|
|
143
|
+
*/
|
|
144
|
+
readIntent(intendedSessionId: string): Promise<TelegramAdoptionIntent | undefined>;
|
|
145
|
+
readPendingTopic(topicId: number): Promise<TelegramPendingTopic | undefined>;
|
|
146
|
+
/**
|
|
147
|
+
* Rehydrate all non-expired intents from the notifications dir. Files are the
|
|
148
|
+
* only source: missing/corrupt/expired entries are skipped (never thrown).
|
|
149
|
+
* Returns the count of live intents loaded.
|
|
150
|
+
*/
|
|
151
|
+
rehydrate(): Promise<number>;
|
|
152
|
+
/**
|
|
153
|
+
* Remove a single intent sidecar and drop its in-memory entry. Safe to call
|
|
154
|
+
* after a successful registry commit or a definite spawn failure. Missing
|
|
155
|
+
* files are not an error. Never calls the Telegram API.
|
|
156
|
+
*/
|
|
157
|
+
remove(intendedSessionId: string): Promise<void>;
|
|
158
|
+
/** Remove a pending-topic authorization after an adoption intent is durable. */
|
|
159
|
+
removePendingTopic(topicId: number): Promise<void>;
|
|
160
|
+
/**
|
|
161
|
+
* Sweep expired intent sidecars from disk. Touches files only. Returns the
|
|
162
|
+
* count of expired sidecars removed. Safe to run at startup and periodically.
|
|
163
|
+
*/
|
|
164
|
+
sweepExpired(): Promise<number>;
|
|
165
|
+
}
|
|
@@ -16,4 +16,16 @@
|
|
|
16
16
|
* If neither --endpoint-file nor --session-id is given, the newest endpoint file
|
|
17
17
|
* under <repo>/.gjc/state/sdk/ is used.
|
|
18
18
|
*/
|
|
19
|
+
import { type TelegramNotificationSound } from "./telegram-reference";
|
|
20
|
+
interface CliArgs {
|
|
21
|
+
botToken?: string;
|
|
22
|
+
chatId?: string;
|
|
23
|
+
endpointFile?: string;
|
|
24
|
+
sessionId?: string;
|
|
25
|
+
repo: string;
|
|
26
|
+
apiBase?: string;
|
|
27
|
+
sound: TelegramNotificationSound;
|
|
28
|
+
force: boolean;
|
|
29
|
+
}
|
|
30
|
+
export declare function parseArgs(argv: string[]): CliArgs;
|
|
19
31
|
export {};
|
|
@@ -38,12 +38,19 @@ export declare const NOTIFICATION_PROTOCOL_VERSION = 3;
|
|
|
38
38
|
* Generation 29 adds serving-epoch compatibility, sidecar heartbeat, root GC,
|
|
39
39
|
* and Bot API cooldown structural fixes (#2956, #2960, #3048).
|
|
40
40
|
* Generation 30 adds opt-in tool activity delivery, closed lifecycle phases,
|
|
41
|
-
* and capability-versioned mixed-host compatibility.
|
|
41
|
+
* and capability-versioned mixed-host compatibility. Generation 31 rolls out
|
|
42
|
+
* non-Linux direct tmux lifecycle cleanup semantics. Generation 32 applies
|
|
43
|
+
* Telegram sound-notification policy across daemon delivery paths. Generation
|
|
44
|
+
* 33 adds action-bound multi-select state rendering and replay-safe option
|
|
45
|
+
* snapshots. Generation 34 converts non-photo image formats (including WebP)
|
|
46
|
+
* into Telegram-compatible photo uploads when possible. Generation 35 adds
|
|
47
|
+
* user-created topic adoption (forum-topic folder picker).
|
|
42
48
|
*/
|
|
43
|
-
export declare const DAEMON_GENERATION =
|
|
49
|
+
export declare const DAEMON_GENERATION = 35;
|
|
44
50
|
/**
|
|
45
51
|
* Serving-compatibility boundary for daemon lifecycle requests. Epoch 1 covers
|
|
46
52
|
* all builds published before this field existed; epoch 2 covered generation 29;
|
|
47
|
-
* bump this to force serving convergence and
|
|
53
|
+
* epoch 3 covered generation 30; bump this to force serving convergence and
|
|
54
|
+
* reload of compatible live predecessors.
|
|
48
55
|
*/
|
|
49
|
-
export declare const SERVING_EPOCH =
|
|
56
|
+
export declare const SERVING_EPOCH = 4;
|
|
@@ -62,6 +62,7 @@ export interface TelegramDaemonFs {
|
|
|
62
62
|
dev?: number;
|
|
63
63
|
ino?: number;
|
|
64
64
|
ctimeMs?: number;
|
|
65
|
+
isDirectory?: () => boolean;
|
|
65
66
|
}>;
|
|
66
67
|
readEndpointFile?(path: string): Promise<NotificationEndpointFile>;
|
|
67
68
|
exactUnlink?(path: string, identity: NotificationEndpointFileIdentity): Promise<NotificationExactUnlinkResult>;
|
|
@@ -722,6 +723,8 @@ export interface TelegramDaemonOptions {
|
|
|
722
723
|
enabled: boolean;
|
|
723
724
|
};
|
|
724
725
|
idleTimeoutMs?: number;
|
|
726
|
+
/** TTL for durable topic-adoption intents (default 10 minutes). Observed, not a fixed contract. */
|
|
727
|
+
adoptionIntentTtlMs?: number;
|
|
725
728
|
scanIntervalMs?: number;
|
|
726
729
|
pid?: number;
|
|
727
730
|
/** Liveness probe for skipping dead-PID endpoint records in {@link TelegramNotificationDaemon.scanRoots}. */
|
|
@@ -758,6 +761,8 @@ export interface TelegramDaemonOptions {
|
|
|
758
761
|
toolActivity?: {
|
|
759
762
|
enabled: boolean;
|
|
760
763
|
};
|
|
764
|
+
/** Controls which Telegram sends play an audible notification. Defaults to all. */
|
|
765
|
+
sound?: "all" | "important" | "none";
|
|
761
766
|
/**
|
|
762
767
|
* Per-session Telegram forum-topic naming. `nameTemplate` supports the
|
|
763
768
|
* `{repo}`, `{branch}`, and `{title}` placeholders; unset preserves the
|
|
@@ -958,7 +963,7 @@ export declare class TelegramNotificationDaemon {
|
|
|
958
963
|
private reserveSeenUpdateId;
|
|
959
964
|
private releaseSeenUpdateId;
|
|
960
965
|
scanRoots(): Promise<void>;
|
|
961
|
-
connectSession(sessionId: string, url: string, token: string):
|
|
966
|
+
connectSession(sessionId: string, url: string, token: string): SessionSocket;
|
|
962
967
|
/**
|
|
963
968
|
* Start ack-based liveness for a session whose server advertised the
|
|
964
969
|
* `client_ping_pong` capability. Each interval drops the session when no pong
|
|
@@ -1030,6 +1035,16 @@ export declare class TelegramNotificationDaemon {
|
|
|
1030
1035
|
private deleteTopic;
|
|
1031
1036
|
private persistTopics;
|
|
1032
1037
|
loadTopics(): Promise<void>;
|
|
1038
|
+
/**
|
|
1039
|
+
* Rehydrate durable adoption intents after restart, then reconcile: a
|
|
1040
|
+
* non-expired sidecar whose target session already has a committed topic
|
|
1041
|
+
* record is a stale leftover (commit succeeded but sidecar cleanup failed)
|
|
1042
|
+
* and is removed safely without touching the user topic.
|
|
1043
|
+
*/
|
|
1044
|
+
loadAdoptionIntents(): Promise<void>;
|
|
1045
|
+
/** Periodic sweep of expired adoption-intent sidecars (files only; no Telegram API). */
|
|
1046
|
+
private startAdoptionSweepTimer;
|
|
1047
|
+
private stopAdoptionSweepTimer;
|
|
1033
1048
|
/** Retry crash-interrupted topic deletes; only a definite Telegram result clears the durable fence. */
|
|
1034
1049
|
private reconcilePendingTopicDeletes;
|
|
1035
1050
|
/** Download one Telegram file with the Bot API's 20 MiB ceiling and one end-to-end deadline. */
|
|
@@ -1117,6 +1132,15 @@ export declare class TelegramNotificationDaemon {
|
|
|
1117
1132
|
handleSessionMessage(session: SessionSocket, msg: any): Promise<void>;
|
|
1118
1133
|
private answerCallbackQueryBestEffort;
|
|
1119
1134
|
private sendStaleGuidance;
|
|
1135
|
+
/**
|
|
1136
|
+
* Consume a user-created forum topic (`forum_topic_created` service message)
|
|
1137
|
+
* before edited/text routing. Authenticates the chat, user, privacy, and
|
|
1138
|
+
* lifecycle state; offers home, recent folders, or explicit path entry. The
|
|
1139
|
+
* selected path (or an exact `/session_create path <dir>`) creates a session
|
|
1140
|
+
* that adopts this topic — never a duplicate topic. Non-routable durable
|
|
1141
|
+
* intents prevent duplicate creation across concurrent first frames.
|
|
1142
|
+
*/
|
|
1143
|
+
private handleForumTopicCreatedUpdate;
|
|
1120
1144
|
/** Consume Telegram forum-topic rename service messages before text routing. */
|
|
1121
1145
|
private handleForumTopicEdited;
|
|
1122
1146
|
private processTelegramUpdate;
|
|
@@ -85,8 +85,17 @@ export declare function buildActionMarkdown(action: {
|
|
|
85
85
|
recommendedIndex?: unknown;
|
|
86
86
|
summary?: string;
|
|
87
87
|
}): string;
|
|
88
|
+
export type TelegramNotificationSound = "all" | "important" | "none";
|
|
89
|
+
export type TelegramDeliveryLane = "ask" | "idle" | "live" | "finalized";
|
|
90
|
+
/**
|
|
91
|
+
* Resolve Telegram's optional silent-delivery flag. `finalChunk` silences
|
|
92
|
+
* non-final actionable chunks under the `important` policy; `undefined`
|
|
93
|
+
* intentionally omits the field so Telegram uses its normal audible delivery
|
|
94
|
+
* behavior.
|
|
95
|
+
*/
|
|
96
|
+
export declare function telegramDisableNotification(sound: TelegramNotificationSound | undefined, lane: TelegramDeliveryLane, finalChunk?: boolean): true | undefined;
|
|
88
97
|
/** Send Telegram HTML text chunks sequentially so long messages preserve order. */
|
|
89
|
-
export declare function sendTelegramHtmlChunks(send: TelegramSend, chatId: string, text: string, inlineKeyboard?: InlineButton[][]): Promise<void>;
|
|
98
|
+
export declare function sendTelegramHtmlChunks(send: TelegramSend, chatId: string, text: string, inlineKeyboard?: InlineButton[][], sound?: TelegramNotificationSound, lane?: TelegramDeliveryLane): Promise<void>;
|
|
90
99
|
/** A protocol `reply` frame the client should send to the server. */
|
|
91
100
|
export interface ReplyFrame {
|
|
92
101
|
type: "reply";
|
|
@@ -128,6 +137,7 @@ export interface TelegramReferenceOptions {
|
|
|
128
137
|
endpointFile: string;
|
|
129
138
|
apiBase?: string;
|
|
130
139
|
fetchImpl?: typeof fetch;
|
|
140
|
+
sound?: TelegramNotificationSound;
|
|
131
141
|
}
|
|
132
142
|
/**
|
|
133
143
|
* Run the reference bridge until the WebSocket closes. Sends `action_needed` to
|
|
@@ -14,13 +14,13 @@ export interface ThreadedSend {
|
|
|
14
14
|
method: "sendMessage" | "sendPhoto" | "sendDocument";
|
|
15
15
|
/** Rate-limit lane for prioritisation/fairness. */
|
|
16
16
|
lane: RateLimitLane;
|
|
17
|
-
/** Message text (sendMessage) or
|
|
17
|
+
/** Message text (sendMessage) or media caption (sendPhoto/sendDocument). */
|
|
18
18
|
text?: string;
|
|
19
19
|
/** Base64 image bytes for sendPhoto. */
|
|
20
20
|
photoBase64?: string;
|
|
21
21
|
/** Base64 file bytes for sendDocument. */
|
|
22
22
|
documentBase64?: string;
|
|
23
|
-
/**
|
|
23
|
+
/** Uploaded media MIME type. */
|
|
24
24
|
mime?: string;
|
|
25
25
|
/** Suggested document filename. */
|
|
26
26
|
fileName?: string;
|
|
@@ -83,6 +83,7 @@ interface ThreadedFrame {
|
|
|
83
83
|
status?: unknown;
|
|
84
84
|
message?: unknown;
|
|
85
85
|
}
|
|
86
|
+
export declare function supportsTelegramPhotoUpload(mime: string | undefined): boolean;
|
|
86
87
|
/** Format the one-time identity header as pinned bullets. */
|
|
87
88
|
export declare function formatIdentityHeader(frame: {
|
|
88
89
|
repo?: unknown;
|
|
@@ -42,6 +42,8 @@ export interface TopicRecord {
|
|
|
42
42
|
creationLeaseEpoch?: number;
|
|
43
43
|
/** An uncertain delete fences future creation and inbound routing. */
|
|
44
44
|
authorityState?: "active" | "delete_pending";
|
|
45
|
+
/** Provenance for topics created by the user and adopted by GJC. Missing means daemon-created. */
|
|
46
|
+
topicOrigin?: "user_created";
|
|
45
47
|
/** Telegram chat and endpoint authority last proven to use this topic. */
|
|
46
48
|
chatId?: string;
|
|
47
49
|
/** Canonical endpoint tuple (URL + token) that currently holds the lease. */
|
|
@@ -129,6 +131,14 @@ export declare class TopicRegistry {
|
|
|
129
131
|
authorityEpoch(sessionId: string): number;
|
|
130
132
|
/** Whether this session has an active, unambiguous topic authority. */
|
|
131
133
|
isActiveUnambiguous(sessionId: string): boolean;
|
|
134
|
+
/**
|
|
135
|
+
* Pure read-only availability check for user-topic adoption. Rejects invalid
|
|
136
|
+
* ids and any id already committed, delete-pending/fenced, staged, or
|
|
137
|
+
* ambiguous, without mutating maps, epochs, or persistence. Used inside the
|
|
138
|
+
* {@link getOrCreateTopic} create callback to fail-closed before adopting a
|
|
139
|
+
* user-created topic id.
|
|
140
|
+
*/
|
|
141
|
+
isTopicIdAvailable(topicId: string): boolean;
|
|
132
142
|
/**
|
|
133
143
|
* Resolve endpoint authority for identity-less replay. An endpoint may bootstrap
|
|
134
144
|
* only when no committed, staged, or pre-create claim can own it; malformed
|
|
@@ -153,7 +163,7 @@ export declare class TopicRegistry {
|
|
|
153
163
|
* Return the existing active topic for `sessionId`, or create one via
|
|
154
164
|
* `create` (called only on first use).
|
|
155
165
|
*/
|
|
156
|
-
getOrCreateTopic(sessionId: string, create: () => Promise<unknown>, now?: () => number, name?: string, binding?: TopicEndpointBinding, commit?: () => Promise<void>, transientClaimant?: object): Promise<TopicRecord>;
|
|
166
|
+
getOrCreateTopic(sessionId: string, create: () => Promise<unknown>, now?: () => number, name?: string, binding?: TopicEndpointBinding, commit?: () => Promise<void>, transientClaimant?: object, topicOrigin?: TopicRecord["topicOrigin"]): Promise<TopicRecord>;
|
|
157
167
|
/** Mark the identity header as sent for a session. Idempotent. */
|
|
158
168
|
markIdentitySent(sessionId: string): void;
|
|
159
169
|
/** Whether the identity header still needs sending for this session. */
|
|
@@ -13,7 +13,7 @@ export interface ControlSurface {
|
|
|
13
13
|
answerAsk(id: string, answer: ControlValue): Promise<ControlValue> | ControlValue;
|
|
14
14
|
answerGate(id: string, response: ControlValue, expectedSessionId?: string, idempotencyKey?: string): Promise<ControlValue> | ControlValue;
|
|
15
15
|
approvePlan(id: string, choice: ControlValue, expectedSessionId?: string): Promise<ControlValue> | ControlValue;
|
|
16
|
-
invokeSkill(name: string, args: ControlValue): Promise<ControlValue> | ControlValue;
|
|
16
|
+
invokeSkill(name: string, args: ControlValue, clientRef?: string): Promise<ControlValue> | ControlValue;
|
|
17
17
|
setPlanMode(on: boolean): Promise<ControlValue> | ControlValue;
|
|
18
18
|
operateGoal(op: string, objective?: string): Promise<ControlValue> | ControlValue;
|
|
19
19
|
replaceTodo(items: ControlValue): Promise<ControlValue> | ControlValue;
|
|
@@ -7,6 +7,8 @@ export interface SessionSdkHostOptions extends HostEndpointAdapters {
|
|
|
7
7
|
query?: (connectionId: string, frame: SdkFrame) => unknown | Promise<unknown>;
|
|
8
8
|
/** Best-effort diagnostic observation of accepted control/query frames. */
|
|
9
9
|
onRequest?: SdkRequestObserver;
|
|
10
|
+
/** Runs before a control response is sent; identity transitions use sendTerminal. */
|
|
11
|
+
beforeControlResponse?: (connectionId: string, request: SdkFrame, response: SdkFrame, sendTerminal: () => Promise<void>) => void | Promise<void>;
|
|
10
12
|
/** Runs only after a successful control response has been sent to the client. */
|
|
11
13
|
afterControlResponse?: (connectionId: string, request: SdkFrame, response: SdkFrame) => void | Promise<void>;
|
|
12
14
|
installProviderDefinitions?: (capability: string, definitions: unknown) => void;
|
|
@@ -37,6 +37,11 @@ export interface SessionSurface {
|
|
|
37
37
|
turnId?: string;
|
|
38
38
|
clientRef?: string;
|
|
39
39
|
}): unknown | Promise<unknown>;
|
|
40
|
+
getSkillInvokeStatus?(selector: {
|
|
41
|
+
commandId?: string;
|
|
42
|
+
turnId?: string;
|
|
43
|
+
clientRef?: string;
|
|
44
|
+
}): unknown | Promise<unknown>;
|
|
40
45
|
/** Q27 effective model-profile catalog from the live session registry. */
|
|
41
46
|
getModelProfiles?(): unknown[] | Promise<unknown[]>;
|
|
42
47
|
/** Query rows backed by the session's installed binding map. */
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/** Test seam: spill directories currently tracked for postmortem cleanup. */
|
|
2
|
+
export declare function trackedSpillDirectoriesForTest(): string[];
|
|
1
3
|
export declare const MAX_REVISIONS_PER_RESOURCE = 8;
|
|
2
4
|
export declare const MAX_PINNED_REVISIONS = 128;
|
|
3
5
|
export declare const MAX_MEMORY_BYTES: number;
|
|
@@ -33,7 +33,7 @@ export declare class ReverseLeaseRuntime {
|
|
|
33
33
|
heartbeat(connectionId: string, leaseId: string): ProviderLease;
|
|
34
34
|
release(connectionId: string, leaseId: string, handoffTo?: string): ProviderLease;
|
|
35
35
|
disconnect(connectionId: string): void;
|
|
36
|
-
request(capability: string, method: string, payload: unknown): Promise<unknown>;
|
|
36
|
+
request(capability: string, method: string, payload: unknown, signal?: AbortSignal): Promise<unknown>;
|
|
37
37
|
respond(connectionId: string, id: string, leaseId: string, result: unknown, error?: {
|
|
38
38
|
code: string;
|
|
39
39
|
message: string;
|
|
@@ -17,8 +17,10 @@
|
|
|
17
17
|
* prior outcome unknown — callers MUST NOT reuse a clientRef as a retry
|
|
18
18
|
* mechanism and MUST treat `unknown` as uncertainty, not proof of
|
|
19
19
|
* non-execution.
|
|
20
|
-
* -
|
|
21
|
-
*
|
|
20
|
+
* - Prompt records survive process restart: an active prompt is finalized from its
|
|
21
|
+
* durable pending outcome, or as `prompt_failed` when it has none. Only skill
|
|
22
|
+
* records settle as `process_restart`, and a lookup reports `unknown` only after
|
|
23
|
+
* retained-record TTL/capacity eviction.
|
|
22
24
|
* - Q26 tracks prompts accepted through the SDK control surface (which always
|
|
23
25
|
* carries a requesting connection); submissions without a delivery owner are
|
|
24
26
|
* outside the reconciliation contract and hold no reservation.
|
|
@@ -34,8 +36,24 @@ export interface TurnPromptInput {
|
|
|
34
36
|
images?: TurnPromptImageInput[];
|
|
35
37
|
clientRef?: string;
|
|
36
38
|
}
|
|
37
|
-
/**
|
|
39
|
+
/**
|
|
40
|
+
* Terminal outcome is preserved exactly; active records never age into terminal. A
|
|
41
|
+
* prompt that is active at process restart is finalized from its durable pending
|
|
42
|
+
* outcome (or `prompt_failed` when it has none), so it never reports as unknown.
|
|
43
|
+
*/
|
|
38
44
|
export type PromptReconciliationStatus = "accepted" | "in_flight" | "terminal_ok" | "failed";
|
|
45
|
+
export type SdkPromptStopReason = "end_turn" | "max_tokens" | "max_turn_requests" | "refusal" | "cancelled";
|
|
46
|
+
export type SdkPromptFailureCode = "prompt_failed" | "prompt_deadline_exceeded";
|
|
47
|
+
export type SdkPromptTerminalOutcome = {
|
|
48
|
+
kind: "stopped";
|
|
49
|
+
reason: SdkPromptStopReason;
|
|
50
|
+
provenance: "agent" | "client_cancel";
|
|
51
|
+
} | {
|
|
52
|
+
kind: "failed";
|
|
53
|
+
code: SdkPromptFailureCode;
|
|
54
|
+
message: string;
|
|
55
|
+
provenance: "agent_failed" | "deadline";
|
|
56
|
+
};
|
|
39
57
|
/** Exactly one selector per lookup. */
|
|
40
58
|
export type TurnPromptStatusSelector = {
|
|
41
59
|
clientRef: string;
|
|
@@ -63,6 +81,7 @@ export interface TurnPromptReconciliationTerminalOk extends TurnPromptReconcilia
|
|
|
63
81
|
startedAt?: number;
|
|
64
82
|
/** Epoch milliseconds of the terminal transition. */
|
|
65
83
|
terminalAt: number;
|
|
84
|
+
outcome?: SdkPromptTerminalOutcome;
|
|
66
85
|
}
|
|
67
86
|
export interface TurnPromptReconciliationFailed extends TurnPromptReconciliationIdentity {
|
|
68
87
|
status: "failed";
|
|
@@ -73,6 +92,7 @@ export interface TurnPromptReconciliationFailed extends TurnPromptReconciliation
|
|
|
73
92
|
code: string;
|
|
74
93
|
message: string;
|
|
75
94
|
};
|
|
95
|
+
outcome?: SdkPromptTerminalOutcome;
|
|
76
96
|
}
|
|
77
97
|
export interface TurnPromptReconciliationUnknown {
|
|
78
98
|
status: "unknown";
|
|
@@ -12,6 +12,7 @@ import type { CustomCommandsLoadResult } from "../extensibility/custom-commands"
|
|
|
12
12
|
import type { CustomTool } from "../extensibility/custom-tools/types";
|
|
13
13
|
import { type ExtensionFactory, type ExtensionUIContext, type LoadExtensionsResult, type ToolDefinition } from "../extensibility/extensions";
|
|
14
14
|
import { type ConstrainedPluginHook } from "../extensibility/gjc-plugins/constrained-hooks";
|
|
15
|
+
import { type GjcRuntimeSnapshotProvider } from "../extensibility/gjc-plugins/runtime-quarantine";
|
|
15
16
|
import { type Skill, type SkillWarning } from "../extensibility/skills";
|
|
16
17
|
import type { FileSlashCommand } from "../extensibility/slash-commands";
|
|
17
18
|
import type { HindsightSessionState } from "../hindsight/state";
|
|
@@ -207,6 +208,11 @@ export interface CreateAgentSessionResult {
|
|
|
207
208
|
lspServers?: LspStartupServerInfo[];
|
|
208
209
|
/** Shared event bus for tool/extension communication */
|
|
209
210
|
eventBus: EventBus;
|
|
211
|
+
/**
|
|
212
|
+
* Read-only view of GJC bundle runtime evidence for the activation generation
|
|
213
|
+
* this session published. Undefined when no GJC bundles participated.
|
|
214
|
+
*/
|
|
215
|
+
gjcRuntimeSnapshot?: GjcRuntimeSnapshotProvider;
|
|
210
216
|
}
|
|
211
217
|
export type { PromptTemplate } from "../config/prompt-templates";
|
|
212
218
|
export { Settings, type SkillsSettings } from "../config/settings";
|