@gajae-code/coding-agent 0.11.6 → 0.11.8
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 +92 -0
- package/dist/types/capability/index.d.ts +10 -20
- package/dist/types/capability/types.d.ts +3 -0
- package/dist/types/cli/args.d.ts +0 -2
- package/dist/types/commands/daemon.d.ts +2 -2
- package/dist/types/commands/sdk.d.ts +20 -2
- package/dist/types/config/keybindings.d.ts +34 -4
- package/dist/types/config/model-profile-activation.d.ts +4 -3
- package/dist/types/config/model-profile-contract.d.ts +38 -0
- package/dist/types/config/settings-schema.d.ts +70 -7
- package/dist/types/edit/modes/patch.d.ts +13 -0
- package/dist/types/edit/path-mutation-lock.d.ts +15 -0
- package/dist/types/eval/py/executor.d.ts +1 -1
- package/dist/types/eval/py/runner-artifact.d.ts +8 -0
- package/dist/types/eval/py/tool-bridge.d.ts +1 -2
- package/dist/types/gjc-runtime/repository-binding.d.ts +63 -0
- package/dist/types/gjc-runtime/ultragoal-guard.d.ts +6 -5
- package/dist/types/gjc-runtime/ultragoal-receipt-freshness.d.ts +20 -0
- package/dist/types/gjc-runtime/ultragoal-runtime.d.ts +43 -5
- package/dist/types/main.d.ts +32 -1
- package/dist/types/modes/components/btw-panel.d.ts +1 -0
- package/dist/types/modes/components/model-selector.d.ts +2 -0
- package/dist/types/modes/components/runtime-mcp-add-wizard.d.ts +2 -1
- package/dist/types/modes/components/tool-status-header.d.ts +4 -2
- package/dist/types/modes/components/welcome.d.ts +2 -0
- package/dist/types/modes/controllers/btw-controller.d.ts +5 -0
- package/dist/types/modes/controllers/command-controller.d.ts +2 -0
- package/dist/types/modes/controllers/selector-controller.d.ts +2 -1
- package/dist/types/modes/interactive-mode.d.ts +7 -2
- package/dist/types/modes/prompt-action-autocomplete.d.ts +6 -1
- package/dist/types/modes/prompt-suggestion-controller.d.ts +35 -0
- package/dist/types/modes/shared/agent-wire/workflow-gate-broker.d.ts +2 -2
- package/dist/types/modes/types.d.ts +4 -0
- package/dist/types/modes/utils/hotkeys-markdown.d.ts +2 -1
- package/dist/types/runtime-mcp/content-limits.d.ts +7 -0
- package/dist/types/runtime-mcp/manager.d.ts +1 -1
- package/dist/types/runtime-mcp/oauth-flow.d.ts +0 -5
- package/dist/types/runtime-mcp/plugin-network-boundary.d.ts +14 -0
- package/dist/types/sdk/broker/broker.d.ts +2 -0
- package/dist/types/sdk/broker/lifecycle.d.ts +6 -0
- package/dist/types/sdk/bus/chat-daemon-control.d.ts +6 -1
- package/dist/types/sdk/bus/config-commands.d.ts +2 -2
- package/dist/types/sdk/bus/config.d.ts +2 -0
- package/dist/types/sdk/bus/conversation-store.d.ts +1 -0
- package/dist/types/sdk/bus/index.d.ts +26 -1
- package/dist/types/sdk/bus/lifecycle-commands.d.ts +5 -4
- package/dist/types/sdk/bus/notification-orchestration.d.ts +1 -0
- package/dist/types/sdk/bus/notification-service.d.ts +34 -0
- package/dist/types/sdk/bus/prompt-reconciliation.d.ts +105 -0
- package/dist/types/sdk/bus/telegram-daemon-contract.d.ts +18 -3
- package/dist/types/sdk/bus/telegram-daemon-control.d.ts +5 -1
- package/dist/types/sdk/bus/telegram-daemon.d.ts +189 -4
- package/dist/types/sdk/bus/telegram-reference.d.ts +2 -0
- package/dist/types/sdk/bus/topic-registry.d.ts +88 -2
- package/dist/types/sdk/client/discovery.d.ts +2 -0
- package/dist/types/sdk/client/liveness.d.ts +7 -0
- package/dist/types/sdk/host/control/operations.d.ts +1 -1
- package/dist/types/sdk/host/host.d.ts +1 -1
- package/dist/types/sdk/host/query/handlers.d.ts +9 -0
- package/dist/types/sdk/index.d.ts +2 -0
- package/dist/types/sdk/prompt-status.d.ts +88 -0
- package/dist/types/sdk/session-directory.d.ts +1 -1
- package/dist/types/sdk/startup-capability.d.ts +3 -0
- package/dist/types/sdk/transport/auth-preface.d.ts +9 -0
- package/dist/types/sdk/transport/index.d.ts +12 -0
- package/dist/types/sdk/transport/relay.d.ts +43 -0
- package/dist/types/sdk/transport/serve-cli.d.ts +4 -0
- package/dist/types/sdk/transport/socket.d.ts +7 -0
- package/dist/types/sdk/transport/stdio.d.ts +3 -0
- package/dist/types/session/agent-session.d.ts +30 -5
- package/dist/types/session/btw-contract.d.ts +16 -0
- package/dist/types/session/internal/managed-session-scope.d.ts +32 -9
- package/dist/types/session/internal/managed-session-storage.d.ts +27 -10
- package/dist/types/session/internal/native-publish-outcome.d.ts +48 -0
- package/dist/types/session/session-manager.d.ts +25 -4
- package/dist/types/session/session-storage.d.ts +18 -0
- package/dist/types/setup/credential-import.d.ts +5 -1
- package/dist/types/setup/provider-onboarding.d.ts +2 -0
- package/dist/types/ssh/utils.d.ts +1 -0
- package/dist/types/task/discovery.d.ts +3 -1
- package/dist/types/task/index.d.ts +3 -1
- package/dist/types/task/receipt.d.ts +2 -0
- package/dist/types/task/types.d.ts +94 -0
- package/dist/types/tools/ask.d.ts +454 -174
- package/dist/types/tools/fetch.d.ts +5 -8
- package/dist/types/tools/image-gen.d.ts +63 -1
- package/dist/types/tools/index.d.ts +4 -0
- package/dist/types/tools/skill-discovery.d.ts +7 -0
- package/dist/types/tools/sqlite-reader.d.ts +7 -0
- package/dist/types/utils/prompt-suggestion.d.ts +33 -0
- package/dist/types/utils/shell-snapshot.d.ts +12 -0
- package/dist/types/web/insane/bridge.d.ts +1 -0
- package/dist/types/web/insane/url-guard.d.ts +17 -0
- package/package.json +8 -8
- package/scripts/capture-platform-shortcut-labels-showcase.ts +342 -0
- package/scripts/dogfood-repository-binding.ts +209 -0
- package/scripts/generate-sdk-operation-inventory.ts +4 -0
- package/scripts/run-test-manifest.ts +4 -4
- package/src/capability/index.ts +50 -42
- package/src/capability/types.ts +3 -0
- package/src/cli/args.ts +2 -92
- package/src/cli/notify-cli.ts +5 -38
- package/src/cli/setup-cli.ts +10 -4
- package/src/cli.ts +52 -9
- package/src/commands/daemon.ts +22 -5
- package/src/commands/sdk.ts +44 -11
- package/src/config/keybindings.ts +158 -25
- package/src/config/model-profile-activation.ts +7 -18
- package/src/config/model-profile-contract.ts +161 -0
- package/src/config/model-profiles.ts +18 -0
- package/src/config/model-registry.ts +11 -1
- package/src/config/settings-schema.ts +73 -7
- package/src/coordinator-mcp/model-preset.ts +21 -74
- package/src/defaults/gjc/skills/deep-interview/SKILL.md +2 -2
- package/src/defaults/gjc/skills/ralplan/SKILL.md +3 -1
- package/src/defaults/gjc/skills/ultragoal/SKILL.md +42 -1
- package/src/discovery/ssh.ts +12 -1
- package/src/edit/index.ts +3 -6
- package/src/edit/modes/patch.ts +38 -1
- package/src/edit/modes/replace.ts +42 -0
- package/src/edit/path-mutation-lock.ts +112 -0
- package/src/eval/py/executor.ts +30 -11
- package/src/eval/py/kernel.ts +1 -21
- package/src/eval/py/prelude.py +2 -2
- package/src/eval/py/runner-artifact.ts +84 -0
- package/src/eval/py/tool-bridge.ts +34 -18
- package/src/extensibility/gjc-plugins/runtime-adapters.ts +2 -1
- package/src/extensibility/plugins/marketplace/fetcher.ts +191 -7
- package/src/gjc-runtime/launch-tmux.ts +1 -1
- package/src/gjc-runtime/managed-owner-supervisor.ts +83 -4
- package/src/gjc-runtime/ralplan-runtime.ts +75 -3
- package/src/gjc-runtime/repository-binding.ts +267 -0
- package/src/gjc-runtime/session-state-sidecar.ts +25 -9
- package/src/gjc-runtime/tmux-owner-isolation.ts +2 -1
- package/src/gjc-runtime/tmux-sessions.ts +45 -6
- package/src/gjc-runtime/ultragoal-guard.ts +93 -15
- package/src/gjc-runtime/ultragoal-receipt-freshness.ts +103 -0
- package/src/gjc-runtime/ultragoal-runtime.ts +456 -31
- package/src/gjc-runtime/workflow-manifest.generated.json +58 -0
- package/src/gjc-runtime/workflow-manifest.ts +23 -0
- package/src/internal-urls/docs-index.generated.ts +12 -10
- package/src/internal-urls/local-protocol.ts +64 -21
- package/src/internal-urls/mcp-protocol.ts +73 -11
- package/src/main.ts +111 -37
- package/src/modes/DESIGN.md +5 -0
- package/src/modes/acp/acp-agent.ts +50 -16
- package/src/modes/action-registry.ts +1 -1
- package/src/modes/components/btw-panel.ts +82 -16
- package/src/modes/components/model-selector.ts +73 -11
- package/src/modes/components/plan-preview-overlay.ts +1 -1
- package/src/modes/components/runtime-mcp-add-wizard.ts +5 -0
- package/src/modes/components/tool-status-header.ts +25 -4
- package/src/modes/components/welcome.ts +22 -18
- package/src/modes/controllers/btw-controller.ts +119 -36
- package/src/modes/controllers/command-controller.ts +97 -54
- package/src/modes/controllers/event-controller.ts +10 -0
- package/src/modes/controllers/input-controller.ts +38 -2
- package/src/modes/controllers/runtime-mcp-command-controller.ts +29 -6
- package/src/modes/controllers/selector-controller.ts +149 -63
- package/src/modes/interactive-mode.ts +57 -34
- package/src/modes/prompt-action-autocomplete.ts +32 -13
- package/src/modes/prompt-suggestion-controller.ts +96 -0
- package/src/modes/shared/agent-wire/workflow-gate-broker.ts +2 -2
- package/src/modes/types.ts +4 -0
- package/src/modes/utils/hotkeys-markdown.ts +64 -36
- package/src/modes/utils/ui-helpers.ts +5 -3
- package/src/prompts/agents/architect.md +0 -1
- package/src/prompts/agents/critic.md +0 -1
- package/src/prompts/system/btw-user.md +3 -8
- package/src/prompts/system/prompt-suggestion-system.md +32 -0
- package/src/prompts/system/system-prompt.md +6 -4
- package/src/prompts/tools/cron.md +3 -1
- package/src/prompts/tools/skill-discovery.md +1 -0
- package/src/runtime-mcp/client.ts +41 -55
- package/src/runtime-mcp/content-limits.ts +71 -0
- package/src/runtime-mcp/json-rpc.ts +23 -9
- package/src/runtime-mcp/manager.ts +51 -53
- package/src/runtime-mcp/oauth-flow.ts +0 -72
- package/src/runtime-mcp/plugin-network-boundary.ts +101 -0
- package/src/runtime-mcp/transports/http.ts +63 -22
- package/src/sdk/broker/broker.ts +34 -20
- package/src/sdk/broker/lifecycle.ts +185 -36
- package/src/sdk/bus/chat-daemon-control.ts +19 -5
- package/src/sdk/bus/config-commands.ts +2 -2
- package/src/sdk/bus/config.ts +9 -1
- package/src/sdk/bus/conversation-store.ts +40 -6
- package/src/sdk/bus/index.ts +244 -70
- package/src/sdk/bus/lifecycle-commands.ts +63 -10
- package/src/sdk/bus/lifecycle-control-runtime.ts +11 -2
- package/src/sdk/bus/lifecycle-orchestrator.ts +32 -1
- package/src/sdk/bus/notification-orchestration.ts +12 -0
- package/src/sdk/bus/notification-service.ts +68 -20
- package/src/sdk/bus/prompt-reconciliation.ts +239 -0
- package/src/sdk/bus/recent-activity.ts +90 -26
- package/src/sdk/bus/telegram-daemon-contract.ts +18 -3
- package/src/sdk/bus/telegram-daemon-control.ts +147 -35
- package/src/sdk/bus/telegram-daemon.ts +2463 -450
- package/src/sdk/bus/telegram-reference.ts +20 -2
- package/src/sdk/bus/topic-registry.ts +451 -12
- package/src/sdk/cli/session-cli.ts +15 -2
- package/src/sdk/client/discovery.ts +19 -3
- package/src/sdk/client/liveness.ts +49 -0
- package/src/sdk/host/control/dispatch.ts +1 -1
- package/src/sdk/host/control/operations.ts +1 -1
- package/src/sdk/host/host.ts +2 -6
- package/src/sdk/host/query/handlers.ts +70 -5
- package/src/sdk/index.ts +12 -0
- package/src/sdk/prompt-status.ts +97 -0
- package/src/sdk/protocol/operation-inventory.generated.json +58 -0
- package/src/sdk/protocol/operation-registry.ts +18 -4
- package/src/sdk/session-directory.ts +5 -1
- package/src/sdk/session.ts +31 -5
- package/src/sdk/startup-capability.ts +9 -1
- package/src/sdk/transport/auth-preface.ts +82 -0
- package/src/sdk/transport/index.ts +18 -0
- package/src/sdk/transport/relay.ts +252 -0
- package/src/sdk/transport/serve-cli.ts +105 -0
- package/src/sdk/transport/socket.ts +197 -0
- package/src/sdk/transport/stdio.ts +17 -0
- package/src/session/agent-session.ts +292 -154
- package/src/session/blob-store.ts +25 -7
- package/src/session/btw-contract.ts +59 -0
- package/src/session/internal/managed-session-scope.ts +1163 -137
- package/src/session/internal/managed-session-storage.ts +397 -234
- package/src/session/internal/native-publish-outcome.ts +266 -0
- package/src/session/session-manager.ts +620 -403
- package/src/session/session-storage.ts +128 -11
- package/src/setup/credential-import.ts +28 -3
- package/src/setup/provider-onboarding.ts +30 -1
- package/src/setup/provider-presets.json +2 -1
- package/src/slash-commands/builtin-registry.ts +1 -1
- package/src/ssh/utils.ts +14 -0
- package/src/task/discovery.ts +8 -2
- package/src/task/gjc-command.ts +2 -2
- package/src/task/index.ts +121 -15
- package/src/task/receipt.ts +3 -0
- package/src/task/types.ts +34 -3
- package/src/tools/ask.ts +199 -89
- package/src/tools/ast-edit.ts +2 -2
- package/src/tools/bash-pty-selection.ts +2 -2
- package/src/tools/browser/screenshot-format.ts +6 -1
- package/src/tools/cron.ts +1 -1
- package/src/tools/fetch.ts +13 -131
- package/src/tools/image-gen.ts +476 -23
- package/src/tools/index.ts +4 -0
- package/src/tools/read.ts +2 -0
- package/src/tools/render-utils.ts +7 -1
- package/src/tools/skill-discovery.ts +39 -3
- package/src/tools/sqlite-reader.ts +63 -5
- package/src/utils/edit-mode.ts +2 -2
- package/src/utils/pasted-image-path.ts +15 -6
- package/src/utils/prompt-suggestion.ts +265 -0
- package/src/utils/shell-snapshot.ts +173 -63
- package/src/utils/sixel.ts +3 -3
- package/src/web/insane/bridge.ts +5 -1
- package/src/web/insane/url-guard.ts +140 -27
- package/src/web/scrapers/docs-rs.ts +30 -5
- package/src/web/scrapers/types.ts +19 -49
- package/src/web/scrapers/utils.ts +12 -26
|
@@ -4,11 +4,13 @@ import type { DaemonRuntimeInfo } from "../../daemon/control-types";
|
|
|
4
4
|
import { HEARTBEAT_TTL_MS } from "./daemon-paths";
|
|
5
5
|
import { type DaemonTransitionLock, type NotificationEndpointFile, type NotificationEndpointFileIdentity, type NotificationExactUnlinkResult } from "./notification-service";
|
|
6
6
|
import { type DaemonProcessReference } from "./telegram-daemon-control";
|
|
7
|
+
import { type TelegramSetupPreflight } from "./telegram-setup";
|
|
7
8
|
export { DAEMON_GENERATION, NOTIFICATION_PROTOCOL_VERSION } from "./telegram-daemon-contract";
|
|
8
9
|
import { type ControlServerLike, type LifecycleControlServerFactory } from "./lifecycle-control-runtime";
|
|
9
10
|
import type { OrchestratorDeps } from "./lifecycle-orchestrator";
|
|
10
11
|
import { NotificationOperatorRuntime, OperatorBackoffPolicy } from "./operator-runtime";
|
|
11
12
|
import { type AliasTable, type CallbackRoute } from "./telegram-reference";
|
|
13
|
+
import { type TopicEndpointBinding } from "./topic-registry";
|
|
12
14
|
export type EnsureDaemonResult = "owner_spawned" | "attached" | "disabled" | "blocked";
|
|
13
15
|
/** Detailed result for orchestration that must distinguish a #2028 handoff from a fresh spawn. */
|
|
14
16
|
export type EnsureTelegramDaemonDetailedResult = "spawned" | "reloaded" | "attached" | "disabled" | "blocked_identity";
|
|
@@ -54,6 +56,10 @@ export interface TelegramDaemonFs {
|
|
|
54
56
|
chmod(path: string, mode: number): Promise<void>;
|
|
55
57
|
stat?(path: string): Promise<{
|
|
56
58
|
mtimeMs: number;
|
|
59
|
+
size?: number;
|
|
60
|
+
dev?: number;
|
|
61
|
+
ino?: number;
|
|
62
|
+
ctimeMs?: number;
|
|
57
63
|
}>;
|
|
58
64
|
readEndpointFile?(path: string): Promise<NotificationEndpointFile>;
|
|
59
65
|
exactUnlink?(path: string, identity: NotificationEndpointFileIdentity): Promise<NotificationExactUnlinkResult>;
|
|
@@ -101,6 +107,21 @@ export declare const ASK_SELECTED_ACK_CAPABILITY = "ask_selected_ack_v1";
|
|
|
101
107
|
export declare const ASK_CONTROLS_CAPABILITY = "ask_controls_v1";
|
|
102
108
|
/** Capability required for tool lifecycle and reasoning-summary frames. */
|
|
103
109
|
export declare const TOOL_ACTIVITY_CAPABILITY = "tool_activity_v1";
|
|
110
|
+
/**
|
|
111
|
+
* File-lock options whose acquisition budget covers the full reload-reservation
|
|
112
|
+
* critical section: the in-lock freshness poll plus the controller's
|
|
113
|
+
* graceful+kill+readiness sequence, with headroom. A contender must be able to
|
|
114
|
+
* wait out a legitimate slow reload and then attach, never fail startup.
|
|
115
|
+
*/
|
|
116
|
+
export declare function reloadReservationLockOptions(input: {
|
|
117
|
+
freshnessWaitMs: number;
|
|
118
|
+
readinessTimeoutMs: number;
|
|
119
|
+
retryDelayMs?: number;
|
|
120
|
+
}): {
|
|
121
|
+
staleMs: number;
|
|
122
|
+
retries: number;
|
|
123
|
+
retryDelayMs: number;
|
|
124
|
+
};
|
|
104
125
|
export declare const BTW_QUESTION_MAX_UNICODE_SCALARS = 4096;
|
|
105
126
|
export declare const BTW_QUESTION_MAX_UTF8_BYTES = 16384;
|
|
106
127
|
export declare function endpointAuthorityDigest(url: string, token: string, connectionIdentity?: string): string;
|
|
@@ -136,12 +157,22 @@ type LegacyOwnershipLockMetadata = {
|
|
|
136
157
|
incarnation?: string;
|
|
137
158
|
startedAt: number;
|
|
138
159
|
};
|
|
160
|
+
type V010OwnershipLockMetadata = {
|
|
161
|
+
size: 0;
|
|
162
|
+
mtimeMs?: number;
|
|
163
|
+
dev?: number;
|
|
164
|
+
ino?: number;
|
|
165
|
+
ctimeMs?: number;
|
|
166
|
+
};
|
|
139
167
|
type OwnershipLockRead = {
|
|
140
168
|
kind: "missing";
|
|
141
169
|
} | {
|
|
142
170
|
kind: "malformed";
|
|
143
171
|
raw: string;
|
|
144
172
|
mtimeMs?: number;
|
|
173
|
+
} | {
|
|
174
|
+
kind: "v010";
|
|
175
|
+
metadata: V010OwnershipLockMetadata;
|
|
145
176
|
} | {
|
|
146
177
|
kind: "legacy";
|
|
147
178
|
metadata: LegacyOwnershipLockMetadata;
|
|
@@ -187,7 +218,84 @@ export declare function unregisterNotificationRoot(input: {
|
|
|
187
218
|
sessionId: string;
|
|
188
219
|
fs?: TelegramDaemonFs;
|
|
189
220
|
}): Promise<UnregisterNotificationRootResult>;
|
|
221
|
+
/**
|
|
222
|
+
* Leak artifact prefixes left when native exact-unlink cleanup is retained
|
|
223
|
+
* (#2956). Nothing previously reaped these; they accumulate in the notifications
|
|
224
|
+
* directory across ownership transitions.
|
|
225
|
+
*/
|
|
226
|
+
export declare const NOTIFICATION_LEAK_ARTIFACT_PREFIXES: readonly [".gjc-delete-daemon-transition-", ".gjc-exact-unlink-placeholder-", ".gjc-delete-notification-endpoint-"];
|
|
227
|
+
/** Grace window before a leak artifact is reaped (covers in-flight unlinks). */
|
|
228
|
+
export declare const NOTIFICATION_LEAK_ARTIFACT_GRACE_MS: number;
|
|
229
|
+
/** True when a path is permanently gone (not a transient I/O blip). */
|
|
230
|
+
export declare function isPermanentMissingPathError(error: unknown): boolean;
|
|
231
|
+
export declare function isNotificationLeakArtifactName(name: string): boolean;
|
|
232
|
+
/**
|
|
233
|
+
* Drop permanently missing scan roots from the durable registry under the roots
|
|
234
|
+
* lock. Session map entries that pointed only at those roots are removed too.
|
|
235
|
+
*/
|
|
236
|
+
export declare function pruneMissingNotificationRoots(input: {
|
|
237
|
+
settings: Settings;
|
|
238
|
+
fs?: TelegramDaemonFs;
|
|
239
|
+
/** When set, only these roots are considered; otherwise every registered root is probed. */
|
|
240
|
+
candidates?: readonly string[];
|
|
241
|
+
}): Promise<{
|
|
242
|
+
pruned: string[];
|
|
243
|
+
remaining: number;
|
|
244
|
+
}>;
|
|
245
|
+
/**
|
|
246
|
+
* Reap retained exact-unlink / ownership-transition quarantine files older than
|
|
247
|
+
* the grace window from the notifications directory.
|
|
248
|
+
*/
|
|
249
|
+
export declare function reapStaleNotificationArtifacts(input: {
|
|
250
|
+
settings: Settings;
|
|
251
|
+
fs?: TelegramDaemonFs;
|
|
252
|
+
now?: () => number;
|
|
253
|
+
graceMs?: number;
|
|
254
|
+
}): Promise<{
|
|
255
|
+
removed: string[];
|
|
256
|
+
skipped: number;
|
|
257
|
+
}>;
|
|
258
|
+
/**
|
|
259
|
+
* Startup / ownership self-heal: prune dead roots and reap leak artifacts so
|
|
260
|
+
* `gjc daemon reload` recovers a degraded install without manual surgery (#2956).
|
|
261
|
+
*/
|
|
262
|
+
export declare function healTelegramDaemonNotificationState(input: {
|
|
263
|
+
settings: Settings;
|
|
264
|
+
fs?: TelegramDaemonFs;
|
|
265
|
+
now?: () => number;
|
|
266
|
+
graceMs?: number;
|
|
267
|
+
}): Promise<{
|
|
268
|
+
prunedRoots: string[];
|
|
269
|
+
removedArtifacts: string[];
|
|
270
|
+
}>;
|
|
190
271
|
export declare function hasSafeDaemonStateShape(state: unknown): state is DaemonState;
|
|
272
|
+
type ParentDaemonStateBase = Omit<DaemonState, "incarnation" | "acquisitionId" | "ownershipPhase" | "generation" | "launcherPid"> & {
|
|
273
|
+
incarnation?: undefined;
|
|
274
|
+
acquisitionId?: undefined;
|
|
275
|
+
ownershipPhase?: undefined;
|
|
276
|
+
generation?: unknown;
|
|
277
|
+
launcherPid?: undefined;
|
|
278
|
+
};
|
|
279
|
+
type GenerationAbsentParentDaemonState = Omit<ParentDaemonStateBase, "generation"> & {
|
|
280
|
+
generation?: undefined;
|
|
281
|
+
};
|
|
282
|
+
type Generation3ReleaseDaemonState = Omit<ParentDaemonStateBase, "generation"> & {
|
|
283
|
+
generation: 3;
|
|
284
|
+
};
|
|
285
|
+
export type LegacyParentDaemonState = GenerationAbsentParentDaemonState | Generation3ReleaseDaemonState;
|
|
286
|
+
export interface AttestedLegacyDaemonOwner {
|
|
287
|
+
state: LegacyParentDaemonState;
|
|
288
|
+
incarnation: string;
|
|
289
|
+
}
|
|
290
|
+
/** Revalidate the exact two-observation legacy proof immediately before signaling. */
|
|
291
|
+
export declare function readAttestedLegacyDaemonOwner(input: {
|
|
292
|
+
settings: Settings;
|
|
293
|
+
fs?: TelegramDaemonFs;
|
|
294
|
+
now?: () => number;
|
|
295
|
+
pidIncarnation?: (pid: number) => string | undefined;
|
|
296
|
+
tokenFingerprint: string;
|
|
297
|
+
chatId: string;
|
|
298
|
+
}): Promise<AttestedLegacyDaemonOwner | undefined>;
|
|
191
299
|
/** True for a physically live owner with this configuration, including legacy generations. */
|
|
192
300
|
export declare function isPhysicalMatchingOwner(input: {
|
|
193
301
|
state: DaemonState | undefined;
|
|
@@ -196,7 +304,7 @@ export declare function isPhysicalMatchingOwner(input: {
|
|
|
196
304
|
pidAlive: (pid: number) => boolean;
|
|
197
305
|
pidIncarnation?: (pid: number) => string | undefined;
|
|
198
306
|
}): boolean;
|
|
199
|
-
/** True only for a
|
|
307
|
+
/** True only for a fully-provenanced modern owner outside the generation-3 parent schema. */
|
|
200
308
|
export declare function isSignalableMatchingOwner(input: {
|
|
201
309
|
state: DaemonState | undefined;
|
|
202
310
|
tokenFingerprint: string;
|
|
@@ -245,6 +353,7 @@ export declare function acquireDaemonOwnership(input: {
|
|
|
245
353
|
provisional?: boolean;
|
|
246
354
|
reason?: "identity_mismatch";
|
|
247
355
|
reloadRequired?: boolean;
|
|
356
|
+
legacyReloadRequired?: boolean;
|
|
248
357
|
}>;
|
|
249
358
|
export declare function renewDaemonHeartbeat(input: {
|
|
250
359
|
settings: Settings;
|
|
@@ -321,6 +430,8 @@ export declare function confirmTelegramDaemonSpawn(input: {
|
|
|
321
430
|
sleep?: (ms: number) => Promise<void>;
|
|
322
431
|
waitStepMs?: number;
|
|
323
432
|
timeoutMs?: number;
|
|
433
|
+
/** Retain an unproven no-PID child lease during a successor handoff. */
|
|
434
|
+
preserveOnUnprovenChildExit?: boolean;
|
|
324
435
|
}): Promise<boolean>;
|
|
325
436
|
export declare function releaseDaemonOwnership(input: {
|
|
326
437
|
settings: Settings;
|
|
@@ -338,6 +449,22 @@ export declare function releaseDaemonOwnership(input: {
|
|
|
338
449
|
export declare function readDaemonState(settings: Pick<Settings, "getAgentDir">, fs?: TelegramDaemonFs): Promise<DaemonState | undefined>;
|
|
339
450
|
/** Read the persisted notification roots list. */
|
|
340
451
|
export declare function readDaemonRoots(settings: Pick<Settings, "getAgentDir">, fs?: TelegramDaemonFs): Promise<string[]>;
|
|
452
|
+
/** Injectable readers for {@link resolveTelegramSetupPreflight}, defaulting to the real OS/state probes. */
|
|
453
|
+
export interface ResolveTelegramSetupPreflightDeps {
|
|
454
|
+
readDaemonState?: (settings: Settings) => Promise<DaemonState | undefined>;
|
|
455
|
+
pidAlive?: (pid: number) => boolean;
|
|
456
|
+
pidIncarnation?: (pid: number) => string | undefined;
|
|
457
|
+
}
|
|
458
|
+
/**
|
|
459
|
+
* Build the Telegram setup preflight from persisted daemon state. The daemon is
|
|
460
|
+
* reported live ONLY when its PID is alive AND its current process incarnation
|
|
461
|
+
* still matches the persisted incarnation. Skipping the incarnation check makes
|
|
462
|
+
* a stale state file whose PID has been recycled by an unrelated process
|
|
463
|
+
* masquerade as a live owner, which wrongly blocks discovery pairing. Both the
|
|
464
|
+
* `notify setup` CLI and the /settings Notifications tab share this resolver so
|
|
465
|
+
* pairing behaves identically on both surfaces.
|
|
466
|
+
*/
|
|
467
|
+
export declare function resolveTelegramSetupPreflight(settings: Settings, deps?: ResolveTelegramSetupPreflightDeps): Promise<TelegramSetupPreflight>;
|
|
341
468
|
export interface TelegramSpawnOwnerInput {
|
|
342
469
|
settings: Settings;
|
|
343
470
|
roots?: string[];
|
|
@@ -362,6 +489,7 @@ export type TelegramSpawnOwnerResult = {
|
|
|
362
489
|
runtime: DaemonRuntimeInfo;
|
|
363
490
|
warnings: string[];
|
|
364
491
|
reloadRequired?: boolean;
|
|
492
|
+
legacyReloadRequired?: boolean;
|
|
365
493
|
} | {
|
|
366
494
|
result: "blocked";
|
|
367
495
|
runtime: DaemonRuntimeInfo;
|
|
@@ -389,6 +517,29 @@ export declare function buildTelegramDaemonSpawnArgs(input: {
|
|
|
389
517
|
* already-persisted roots.
|
|
390
518
|
*/
|
|
391
519
|
export declare function spawnTelegramDaemonOwner(input: TelegramSpawnOwnerInput, deps?: TelegramDaemonDeps): Promise<TelegramSpawnOwnerResult>;
|
|
520
|
+
/**
|
|
521
|
+
* Owner-bound reclamation of a confirmed-dead daemon owner, mirroring the
|
|
522
|
+
* daemon step of `gjc notify recovery`. It returns a structured, actionable
|
|
523
|
+
* result and removes only identity-verified dead-owner artifacts while holding
|
|
524
|
+
* the transition fence; live, successor, unknown, or unreadable evidence is
|
|
525
|
+
* retained.
|
|
526
|
+
*/
|
|
527
|
+
export type DeadOwnerRecoveryResult = {
|
|
528
|
+
recovered: true;
|
|
529
|
+
reason: "cleared";
|
|
530
|
+
} | {
|
|
531
|
+
recovered: false;
|
|
532
|
+
reason: "not-confirmed-dead" | "unsafe-lock" | "transition-contended" | "owner-superseded" | "unsafe-endpoint" | "endpoint-changed" | "endpoint-directory-unreadable" | "lock-changed";
|
|
533
|
+
};
|
|
534
|
+
/** Preflight cleanup for a confirmed-dead owner, with identity-bound removal. */
|
|
535
|
+
export declare function reclaimDeadDaemonOwner(input: {
|
|
536
|
+
settings: Settings;
|
|
537
|
+
endpointDir?: string;
|
|
538
|
+
fs?: TelegramDaemonFs;
|
|
539
|
+
now?: () => number;
|
|
540
|
+
pidAlive?: (pid: number) => boolean;
|
|
541
|
+
pidIncarnation?: (pid: number) => string | undefined;
|
|
542
|
+
}): Promise<DeadOwnerRecoveryResult>;
|
|
392
543
|
/**
|
|
393
544
|
* Ensure a configured daemon owns this session root, preserving ownership safety
|
|
394
545
|
* while exposing whether a #2028 generation handoff was required.
|
|
@@ -469,6 +620,11 @@ export declare class TelegramEventDispatchState {
|
|
|
469
620
|
readonly busy: Set<string>;
|
|
470
621
|
readonly inboundReactions: Map<number, {
|
|
471
622
|
messageId: number;
|
|
623
|
+
socketLease?: {
|
|
624
|
+
session: SessionSocket;
|
|
625
|
+
token: number;
|
|
626
|
+
logicalSessionId: string;
|
|
627
|
+
};
|
|
472
628
|
}>;
|
|
473
629
|
readonly seenUpdateIds: Set<number>;
|
|
474
630
|
}
|
|
@@ -551,11 +707,15 @@ interface SessionSocket {
|
|
|
551
707
|
sessionId: string;
|
|
552
708
|
/** Current logical session carried by valid threaded frames on this transport. */
|
|
553
709
|
logicalSessionId: string;
|
|
710
|
+
/** Endpoint metadata proved this logical id belongs to this discovery record. */
|
|
711
|
+
logicalSessionIdTrusted: boolean;
|
|
554
712
|
token: string;
|
|
555
713
|
endpointKey: string;
|
|
556
714
|
endpointDigest: string;
|
|
557
715
|
hostGeneration: number;
|
|
558
716
|
ws: WebSocket;
|
|
717
|
+
/** Timestamp (via opts.now) at which this socket began connecting. */
|
|
718
|
+
connectingSince: number;
|
|
559
719
|
pending: Map<string, {
|
|
560
720
|
sessionId: string;
|
|
561
721
|
actionId: string;
|
|
@@ -574,6 +734,13 @@ interface SessionSocket {
|
|
|
574
734
|
/** Queues live frames until startup replay is applied. */
|
|
575
735
|
replayPending: boolean;
|
|
576
736
|
replayQueue: Record<string, unknown>[];
|
|
737
|
+
/** Trusted recovery may not route until its durable endpoint lease is committed. */
|
|
738
|
+
recoveryLease?: {
|
|
739
|
+
state: "pending" | "authorized" | "rejected";
|
|
740
|
+
logicalSessionId: string;
|
|
741
|
+
binding: TopicEndpointBinding;
|
|
742
|
+
token: number;
|
|
743
|
+
};
|
|
577
744
|
}
|
|
578
745
|
export declare class TelegramNotificationDaemon {
|
|
579
746
|
#private;
|
|
@@ -598,12 +765,20 @@ export declare class TelegramNotificationDaemon {
|
|
|
598
765
|
private readonly pollConflictBackoff;
|
|
599
766
|
private readonly loopBackoff;
|
|
600
767
|
private running;
|
|
768
|
+
/** Once set, a concurrent startup await can never restore a running daemon. */
|
|
769
|
+
private stopRequested;
|
|
601
770
|
private readonly fsImpl;
|
|
602
771
|
private readonly botApi;
|
|
603
772
|
private readonly effects;
|
|
604
773
|
private readonly topics;
|
|
605
774
|
/** Serializes registry snapshots so an older atomic write cannot overwrite newer rename state. */
|
|
775
|
+
/** Legacy sockets have no durable token, so explicit teardown is their revocation fence. */
|
|
776
|
+
private readonly droppedSessions;
|
|
606
777
|
private topicsPersistQueue;
|
|
778
|
+
/** Serializes recovery compare/write/publish claims so competing endpoint migrations cannot durably diverge. */
|
|
779
|
+
private recoveryBindingClaimQueue;
|
|
780
|
+
/** Durable compensation fences retry under supervision until persistence succeeds. */
|
|
781
|
+
private readonly compensationFenceRetries;
|
|
607
782
|
/** Daemon edit attempts that can race an accepted user service message. */
|
|
608
783
|
private readonly daemonRenameAttempts;
|
|
609
784
|
private readonly selectedAckPending;
|
|
@@ -616,10 +791,17 @@ export declare class TelegramNotificationDaemon {
|
|
|
616
791
|
private readonly draftStream;
|
|
617
792
|
/** Identity-bearing sessions by repo/branch surface, used to avoid transient duplicate topics. */
|
|
618
793
|
private readonly topicOwnerByIdentity;
|
|
794
|
+
/** Ephemeral legacy topic owners retained across a same-socket config rekey. */
|
|
795
|
+
private readonly legacyTopicOwners;
|
|
796
|
+
/** Preserved initiator topics must not route through a rekeyed transport. */
|
|
797
|
+
private readonly preservedInitiatorTopics;
|
|
619
798
|
/** Non-identity frames held until identity creates the correct thread. */
|
|
620
799
|
private readonly pendingThreadedFrames;
|
|
621
|
-
/**
|
|
800
|
+
/** Durable endpoint leases for sessions that already sent an authorized session_closed. */
|
|
622
801
|
private readonly closedEndpointKeys;
|
|
802
|
+
/** Exactly one authorized transport may route each recovered logical session. */
|
|
803
|
+
private readonly logicalSessionOwners;
|
|
804
|
+
private nextSocketLeaseToken;
|
|
623
805
|
/** True once the daemon has nudged the user to enable Threaded Mode. */
|
|
624
806
|
private threadedFallbackNoticeSent;
|
|
625
807
|
/** Sessions whose identity header was already sent flat (Threaded Mode off). */
|
|
@@ -698,6 +880,7 @@ export declare class TelegramNotificationDaemon {
|
|
|
698
880
|
private pruneSeenUpdateIds;
|
|
699
881
|
private rememberSeenUpdateId;
|
|
700
882
|
private reserveSeenUpdateId;
|
|
883
|
+
private releaseSeenUpdateId;
|
|
701
884
|
scanRoots(): Promise<void>;
|
|
702
885
|
connectSession(sessionId: string, url: string, token: string): void;
|
|
703
886
|
/**
|
|
@@ -734,7 +917,6 @@ export declare class TelegramNotificationDaemon {
|
|
|
734
917
|
private topicIdentityKey;
|
|
735
918
|
private topicIdentityBase;
|
|
736
919
|
private topicOwnerForIdentity;
|
|
737
|
-
private sessionCanClaimIdentity;
|
|
738
920
|
private toolActivityOwner;
|
|
739
921
|
private toolActivityAuthorityIsCurrent;
|
|
740
922
|
private submitThreadedFrame;
|
|
@@ -759,7 +941,9 @@ export declare class TelegramNotificationDaemon {
|
|
|
759
941
|
private deleteTopic;
|
|
760
942
|
private persistTopics;
|
|
761
943
|
loadTopics(): Promise<void>;
|
|
762
|
-
/**
|
|
944
|
+
/** Retry crash-interrupted topic deletes; only a definite Telegram result clears the durable fence. */
|
|
945
|
+
private reconcilePendingTopicDeletes;
|
|
946
|
+
/** Download one Telegram file with the Bot API's 20 MiB ceiling and one end-to-end deadline. */
|
|
763
947
|
private downloadTelegramFile;
|
|
764
948
|
/**
|
|
765
949
|
* Per-session private temp directories (mode 0700) holding inbound non-image
|
|
@@ -781,6 +965,7 @@ export declare class TelegramNotificationDaemon {
|
|
|
781
965
|
* to append to the injected text.
|
|
782
966
|
*/
|
|
783
967
|
private resolveInboundAttachment;
|
|
968
|
+
private resolveInboundAttachmentSerial;
|
|
784
969
|
/**
|
|
785
970
|
* Serialize all pool flushes. Every caller (`submitThreadedFrame`, the flat
|
|
786
971
|
* fallback, the drain timer's `void this.flushPool()`, topic teardown) goes
|
|
@@ -73,6 +73,7 @@ export declare function buildActionMessage(action: {
|
|
|
73
73
|
id: string;
|
|
74
74
|
question?: string;
|
|
75
75
|
options?: string[];
|
|
76
|
+
recommendedIndex?: unknown;
|
|
76
77
|
controls?: readonly TelegramActionControl[];
|
|
77
78
|
summary?: string;
|
|
78
79
|
}): RenderedMessage;
|
|
@@ -81,6 +82,7 @@ export declare function buildActionMarkdown(action: {
|
|
|
81
82
|
kind: "ask" | "idle";
|
|
82
83
|
question?: string;
|
|
83
84
|
options?: string[];
|
|
85
|
+
recommendedIndex?: unknown;
|
|
84
86
|
summary?: string;
|
|
85
87
|
}): string;
|
|
86
88
|
/** Send Telegram HTML text chunks sequentially so long messages preserve order. */
|
|
@@ -38,8 +38,22 @@ export interface TopicRecord {
|
|
|
38
38
|
replaySeq?: number;
|
|
39
39
|
/** Serialized authority epoch; a late create may commit only in its starting epoch. */
|
|
40
40
|
authorityEpoch?: number;
|
|
41
|
+
/** Immutable authority epoch held when this remote topic create began. */
|
|
42
|
+
creationLeaseEpoch?: number;
|
|
41
43
|
/** An uncertain delete fences future creation and inbound routing. */
|
|
42
44
|
authorityState?: "active" | "delete_pending";
|
|
45
|
+
/** Telegram chat and endpoint authority last proven to use this topic. */
|
|
46
|
+
chatId?: string;
|
|
47
|
+
/** Canonical endpoint tuple (URL + token) that currently holds the lease. */
|
|
48
|
+
endpointKey?: string;
|
|
49
|
+
/** Authenticated endpoint authority digest, excluding transport presentation. */
|
|
50
|
+
endpointDigest?: string;
|
|
51
|
+
/** SDK event generation associated with the current endpoint lease. */
|
|
52
|
+
endpointGeneration?: number;
|
|
53
|
+
/** Monotonic authenticated endpoint handoffs; legacy bindings begin at zero. */
|
|
54
|
+
endpointIncarnation?: number;
|
|
55
|
+
/** True when persisted binding fields were present but malformed; recovery must fail closed. */
|
|
56
|
+
bindingMalformed?: true;
|
|
43
57
|
}
|
|
44
58
|
/** Serialisable shape persisted to disk. */
|
|
45
59
|
export interface TopicRegistryState {
|
|
@@ -47,6 +61,34 @@ export interface TopicRegistryState {
|
|
|
47
61
|
topics: Record<string, TopicRecord>;
|
|
48
62
|
/** Durable deletion epochs retained after a definite delete. */
|
|
49
63
|
fences?: Record<string, number>;
|
|
64
|
+
/** Closed transport endpoint leases; unchanged endpoint discovery remains fenced across restart. */
|
|
65
|
+
closedEndpoints?: Record<string, TopicEndpointBinding>;
|
|
66
|
+
}
|
|
67
|
+
/** Authenticated runtime binding for a durable topic lease. */
|
|
68
|
+
export interface TopicEndpointBinding {
|
|
69
|
+
chatId: string;
|
|
70
|
+
endpointKey: string;
|
|
71
|
+
endpointDigest: string;
|
|
72
|
+
endpointGeneration?: number;
|
|
73
|
+
}
|
|
74
|
+
/** Discriminated durable endpoint authority for identity-less replay admission. */
|
|
75
|
+
export type TopicEndpointAuthority = {
|
|
76
|
+
state: "none";
|
|
77
|
+
} | {
|
|
78
|
+
state: "unique";
|
|
79
|
+
sessionId: string;
|
|
80
|
+
} | {
|
|
81
|
+
state: "ambiguous";
|
|
82
|
+
};
|
|
83
|
+
/** Conditional rollback token for a delete fence publication. */
|
|
84
|
+
export interface TopicDeleteAuthoritySnapshot {
|
|
85
|
+
sessionId: string;
|
|
86
|
+
topicId?: string;
|
|
87
|
+
authorityEpoch?: number;
|
|
88
|
+
authorityState?: TopicRecord["authorityState"];
|
|
89
|
+
fenceEpoch?: number;
|
|
90
|
+
/** Exact fenced record, retained to restore an in-memory tombstone after a failed clear publication. */
|
|
91
|
+
record?: TopicRecord;
|
|
50
92
|
}
|
|
51
93
|
export declare function emptyTopicRegistryState(): TopicRegistryState;
|
|
52
94
|
/**
|
|
@@ -61,9 +103,17 @@ export declare class TopicRegistry {
|
|
|
61
103
|
private readonly byTopic;
|
|
62
104
|
/** In-flight create promises, keyed by session, to dedupe concurrent creates. */
|
|
63
105
|
private readonly inflight;
|
|
106
|
+
/** Newly-created records being durably published; never routable until committed. */
|
|
107
|
+
private readonly staged;
|
|
108
|
+
/** Socket-specific provenance for transient endpoint claims. */
|
|
109
|
+
private readonly transientClaimants;
|
|
110
|
+
/** Endpoint claims registered before a remote topic create can publish a record. */
|
|
111
|
+
private readonly creatingBindings;
|
|
64
112
|
/** Monotonic authority epochs, including deletion fences for absent records. */
|
|
65
113
|
private readonly epochs;
|
|
66
114
|
constructor(state?: TopicRegistryState);
|
|
115
|
+
/** Replace all runtime state after a successfully persisted staged publication. */
|
|
116
|
+
replace(state: TopicRegistryState): void;
|
|
67
117
|
/** Merge serialized state and normalize authority fields from older releases. */
|
|
68
118
|
load(state: TopicRegistryState): void;
|
|
69
119
|
private rebuildInboundRoutes;
|
|
@@ -71,13 +121,39 @@ export declare class TopicRegistry {
|
|
|
71
121
|
sessionForTopic(topicId: string): string | undefined;
|
|
72
122
|
/** All session ids with a persisted topic record. */
|
|
73
123
|
sessionIds(): string[];
|
|
124
|
+
/** Persisted remote deletes that must be reconciled before recovery can proceed. */
|
|
125
|
+
deletePendingSessionIds(): string[];
|
|
74
126
|
/** The existing topic record for a session, if any. */
|
|
75
127
|
get(sessionId: string): TopicRecord | undefined;
|
|
128
|
+
/** Current immutable authority epoch for a creation lease. */
|
|
129
|
+
authorityEpoch(sessionId: string): number;
|
|
130
|
+
/** Whether this session has an active, unambiguous topic authority. */
|
|
131
|
+
isActiveUnambiguous(sessionId: string): boolean;
|
|
132
|
+
/**
|
|
133
|
+
* Resolve endpoint authority for identity-less replay. An endpoint may bootstrap
|
|
134
|
+
* only when no committed, staged, or pre-create claim can own it; malformed
|
|
135
|
+
* partial bindings and deletion fences deliberately fail closed.
|
|
136
|
+
*/
|
|
137
|
+
endpointAuthority(binding: TopicEndpointBinding, excludedTransientClaimant?: object): TopicEndpointAuthority;
|
|
138
|
+
/** Resolve a uniquely bound logical owner for callers that only need the owner. */
|
|
139
|
+
uniqueSessionForEndpoint(binding: TopicEndpointBinding): string | undefined;
|
|
140
|
+
/** Whether this exact session owns the complete durable endpoint binding. */
|
|
141
|
+
matchesEndpoint(sessionId: string, binding: TopicEndpointBinding): boolean;
|
|
142
|
+
/**
|
|
143
|
+
* Rebind an existing topic to an authenticated successor endpoint. The exact
|
|
144
|
+
* logical session id is proved by replay before this method is called. A
|
|
145
|
+
* rotated credential may replace only an inactive incumbent; concurrent
|
|
146
|
+
* incumbents, cross-chat records, malformed evidence, collisions, and delete
|
|
147
|
+
* fences remain fail-closed.
|
|
148
|
+
*/
|
|
149
|
+
bindEndpoint(sessionId: string, binding: TopicEndpointBinding, activeEndpointKeys?: ReadonlySet<string>, allowEndpointRotation?: boolean): "bound" | "unchanged" | "rejected";
|
|
150
|
+
/** Undo a failed durable endpoint migration without disturbing concurrent metadata writers. */
|
|
151
|
+
restoreEndpointBinding(sessionId: string, expected: TopicEndpointBinding, previous: Pick<TopicRecord, "chatId" | "endpointKey" | "endpointDigest" | "endpointGeneration" | "endpointIncarnation">): boolean;
|
|
76
152
|
/**
|
|
77
153
|
* Return the existing active topic for `sessionId`, or create one via
|
|
78
154
|
* `create` (called only on first use).
|
|
79
155
|
*/
|
|
80
|
-
getOrCreateTopic(sessionId: string, create: () => Promise<unknown>, now?: () => number, name?: string): Promise<TopicRecord>;
|
|
156
|
+
getOrCreateTopic(sessionId: string, create: () => Promise<unknown>, now?: () => number, name?: string, binding?: TopicEndpointBinding, commit?: () => Promise<void>, transientClaimant?: object): Promise<TopicRecord>;
|
|
81
157
|
/** Mark the identity header as sent for a session. Idempotent. */
|
|
82
158
|
markIdentitySent(sessionId: string): void;
|
|
83
159
|
/** Whether the identity header still needs sending for this session. */
|
|
@@ -109,14 +185,24 @@ export declare class TopicRegistry {
|
|
|
109
185
|
markUserNamePending(sessionId: string, name: string): boolean;
|
|
110
186
|
/** Commit a successfully-applied daemon topic title. */
|
|
111
187
|
markNameApplied(sessionId: string, name: string): void;
|
|
188
|
+
/** Capture only authority fields that a failed delete publication may restore. */
|
|
189
|
+
captureDeleteAuthority(sessionId: string): TopicDeleteAuthoritySnapshot;
|
|
190
|
+
/** Restore a failed delete fence only while its exact authority mutation remains current. */
|
|
191
|
+
restoreDeleteAuthority(snapshot: TopicDeleteAuthoritySnapshot): boolean;
|
|
192
|
+
/** Restore the exact delete fence after a failed compensation publication. */
|
|
193
|
+
restoreDeleteFence(snapshot: TopicDeleteAuthoritySnapshot): boolean;
|
|
112
194
|
/** Fence new work before the remote delete starts, including an absent in-flight create. */
|
|
113
195
|
beginDelete(sessionId: string): TopicRecord | undefined;
|
|
196
|
+
/** Retain an accepted create as deletion-fenced before remote compensation can begin. */
|
|
197
|
+
fenceAcceptedCreate(sessionId: string, topicId: string, now?: () => number, name?: string, binding?: TopicEndpointBinding): TopicRecord;
|
|
198
|
+
/** Fence an accepted create only when its exact creator lease still owns the record. */
|
|
199
|
+
fenceAcceptedCreateForLease(sessionId: string, topicId: string, creationLeaseEpoch: number, now?: () => number, name?: string, binding?: TopicEndpointBinding): TopicRecord | undefined;
|
|
114
200
|
/** Wait for a revoked create to settle before admitting a later lifecycle epoch. */
|
|
115
201
|
awaitInflight(sessionId: string): Promise<void>;
|
|
116
202
|
/** Remove only after a definite remote deletion; ambiguity deliberately retains its fence. */
|
|
117
203
|
settleDelete(sessionId: string, topicId: string): boolean;
|
|
118
204
|
/** Remove a topic record immediately for local/test cleanup compatibility. */
|
|
119
205
|
delete(sessionId: string): boolean;
|
|
120
|
-
/** Serialise
|
|
206
|
+
/** Serialise active records plus unpublished staged creates for atomic commit. */
|
|
121
207
|
serialize(): TopicRegistryState;
|
|
122
208
|
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { SdkSessionEndpoint } from "./discovery";
|
|
2
|
+
export type SdkEndpointLiveness = "live" | "stale" | "dead" | "unknown";
|
|
3
|
+
export interface SdkEndpointSelectionError {
|
|
4
|
+
code: "endpoint_stale" | "endpoint_dead" | "endpoint_unknown" | "no_live_endpoint" | "multiple_live_endpoints" | "not_found";
|
|
5
|
+
}
|
|
6
|
+
export declare function classifyEndpoint(endpoint: SdkSessionEndpoint): SdkEndpointLiveness;
|
|
7
|
+
export declare function selectLiveEndpoint(records: readonly SdkSessionEndpoint[], explicitSessionId?: string): SdkSessionEndpoint | SdkEndpointSelectionError;
|
|
@@ -5,7 +5,7 @@ export type ControlInput = Record<string, unknown>;
|
|
|
5
5
|
* AgentSession and its controllers without exposing those concrete types here.
|
|
6
6
|
*/
|
|
7
7
|
export interface ControlSurface {
|
|
8
|
-
prompt(text: string, images?: ControlValue): Promise<ControlValue> | ControlValue;
|
|
8
|
+
prompt(text: string, images?: ControlValue, clientRef?: string): Promise<ControlValue> | ControlValue;
|
|
9
9
|
steer(text: string): Promise<ControlValue> | ControlValue;
|
|
10
10
|
followUp(text: string): Promise<ControlValue> | ControlValue;
|
|
11
11
|
abort(): Promise<ControlValue> | ControlValue;
|
|
@@ -13,7 +13,7 @@ export interface SessionSdkHostOptions extends HostEndpointAdapters {
|
|
|
13
13
|
onProviderDefinitionsRemoved?: (capability: string) => void;
|
|
14
14
|
onReverseCancel?: (requestId: string, reason: "provider_disconnected" | "lease_released") => void;
|
|
15
15
|
/** Best-effort capabilities mirrored from the native transport for out-of-band consumers. */
|
|
16
|
-
connectionCapabilities?: (connectionId: string) => ReadonlySet<string
|
|
16
|
+
connectionCapabilities?: (connectionId: string) => ReadonlySet<string> | undefined;
|
|
17
17
|
}
|
|
18
18
|
/** SDK hosting is independent of notification configuration. Only root sessions host an endpoint. */
|
|
19
19
|
export declare function shouldHostSdk(_settings: unknown, isTopLevel: boolean, env?: NodeJS.ProcessEnv): boolean;
|
|
@@ -31,6 +31,14 @@ export interface SessionSurface {
|
|
|
31
31
|
totalBytes: number;
|
|
32
32
|
} | undefined>;
|
|
33
33
|
getJobs(): unknown | Promise<unknown>;
|
|
34
|
+
/** Q26 keyed lookup of a submitted prompt's authoritative reconciliation status. */
|
|
35
|
+
getPromptStatus?(selector: {
|
|
36
|
+
commandId?: string;
|
|
37
|
+
turnId?: string;
|
|
38
|
+
clientRef?: string;
|
|
39
|
+
}): unknown | Promise<unknown>;
|
|
40
|
+
/** Q27 effective model-profile catalog from the live session registry. */
|
|
41
|
+
getModelProfiles?(): unknown[] | Promise<unknown[]>;
|
|
34
42
|
/** Query rows backed by the session's installed binding map. */
|
|
35
43
|
installedQueries?: ReadonlySet<string>;
|
|
36
44
|
}
|
|
@@ -57,6 +65,7 @@ export interface QueryResponse {
|
|
|
57
65
|
code: string;
|
|
58
66
|
message: string;
|
|
59
67
|
restartQuery?: boolean;
|
|
68
|
+
details?: unknown;
|
|
60
69
|
};
|
|
61
70
|
}
|
|
62
71
|
export declare class QueryHandlers {
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
export { MODEL_PROFILE_DISCOVERY_QUERY, MODEL_PROFILE_ERROR_DETAIL_MAX_BYTES, type ModelProfileCatalogItem, type ModelProfileErrorCode, type ModelProfileErrorDetails, ModelProfileRegistryError, type ModelProfileRegistryErrorDetails, type UnknownModelProfileDetails, UnknownModelProfileError, } from "../config/model-profile-contract";
|
|
1
2
|
export * as bus from "./bus";
|
|
2
3
|
export * from "./client";
|
|
3
4
|
export * as host from "./host";
|
|
4
5
|
export * as mcp from "./mcp";
|
|
5
6
|
export type { Q10CurrentThinkingLevel, Q10Model, Q10SettableThinkingLevel, Q10ThinkingCapabilities, Q10ThinkingEffort, Q10ThinkingMode, } from "./models";
|
|
7
|
+
export * from "./prompt-status";
|
|
6
8
|
export * from "./session";
|
|
7
9
|
export * from "./session-directory";
|