@gajae-code/coding-agent 0.11.10 → 0.11.11

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.
Files changed (111) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/dist/types/cli.d.ts +8 -1
  3. package/dist/types/config/model-profile-activation.d.ts +1 -0
  4. package/dist/types/config/model-profile-contract.d.ts +2 -0
  5. package/dist/types/config/settings-schema.d.ts +57 -2
  6. package/dist/types/config/settings.d.ts +1 -0
  7. package/dist/types/extensibility/extensions/types.d.ts +21 -0
  8. package/dist/types/gjc-runtime/linux-proc.d.ts +22 -14
  9. package/dist/types/gjc-runtime/ralplan-runtime.d.ts +60 -0
  10. package/dist/types/gjc-runtime/state-runtime.d.ts +3 -1
  11. package/dist/types/modes/acp/acp-agent.d.ts +14 -9
  12. package/dist/types/modes/components/queue-pane.d.ts +8 -0
  13. package/dist/types/modes/components/queued-message-selector.d.ts +6 -0
  14. package/dist/types/modes/components/welcome.d.ts +1 -0
  15. package/dist/types/modes/interactive-mode.d.ts +5 -1
  16. package/dist/types/runtime/memory-domain.d.ts +9 -0
  17. package/dist/types/runtime/memory-guard-contract.d.ts +71 -0
  18. package/dist/types/runtime/memory-guard.d.ts +39 -0
  19. package/dist/types/runtime/memory-limit.d.ts +11 -0
  20. package/dist/types/runtime-mcp/manager.d.ts +8 -0
  21. package/dist/types/sdk/acp/final-text.d.ts +19 -0
  22. package/dist/types/sdk/acp/mcp.d.ts +23 -0
  23. package/dist/types/sdk/broker/lifecycle.d.ts +2 -0
  24. package/dist/types/sdk/bus/chat-daemon-control.d.ts +2 -1
  25. package/dist/types/sdk/bus/index.d.ts +3 -1
  26. package/dist/types/sdk/bus/rate-limit-pool.d.ts +2 -0
  27. package/dist/types/sdk/bus/telegram-daemon-contract.d.ts +6 -4
  28. package/dist/types/sdk/bus/telegram-daemon.d.ts +23 -3
  29. package/dist/types/sdk/host/control/operations.d.ts +1 -0
  30. package/dist/types/sdk/lifecycle-session.d.ts +10 -1
  31. package/dist/types/sdk/startup-capability.d.ts +6 -0
  32. package/dist/types/session/agent-session.d.ts +9 -11
  33. package/dist/types/session/fallback-chain-controller.d.ts +18 -2
  34. package/dist/types/session/internal/managed-session-scope.d.ts +27 -0
  35. package/dist/types/session/session-manager.d.ts +34 -0
  36. package/dist/types/task/executor.d.ts +6 -0
  37. package/dist/types/task/types.d.ts +36 -0
  38. package/dist/types/task/ultragoal-redteam-activation.d.ts +33 -0
  39. package/dist/types/tools/resource-gc.d.ts +19 -0
  40. package/package.json +8 -8
  41. package/scripts/generate-sdk-operation-inventory.ts +2 -0
  42. package/scripts/run-test-manifest.ts +6 -4
  43. package/src/cli/args.ts +14 -8
  44. package/src/cli/fast-help.ts +1 -1
  45. package/src/cli.ts +48 -2
  46. package/src/commands/sdk.ts +91 -7
  47. package/src/config/model-profile-activation.ts +1 -0
  48. package/src/config/model-profile-contract.ts +13 -0
  49. package/src/config/model-profiles.ts +24 -0
  50. package/src/config/settings-schema.ts +61 -2
  51. package/src/config/settings.ts +8 -0
  52. package/src/defaults/gjc/skills/ralplan/SKILL.md +21 -2
  53. package/src/defaults/gjc/skills/ultragoal/SKILL.md +1 -1
  54. package/src/extensibility/extensions/runner.ts +4 -0
  55. package/src/extensibility/extensions/types.ts +14 -0
  56. package/src/gjc-runtime/deep-interview-ambiguity.ts +16 -2
  57. package/src/gjc-runtime/deep-interview-state.ts +25 -3
  58. package/src/gjc-runtime/linux-proc.ts +70 -36
  59. package/src/gjc-runtime/ralplan-runtime.ts +252 -1
  60. package/src/gjc-runtime/state-runtime.ts +48 -11
  61. package/src/internal-urls/docs-index.generated.ts +4 -4
  62. package/src/internal-urls/local-protocol.ts +23 -4
  63. package/src/modes/acp/acp-agent.ts +554 -60
  64. package/src/modes/acp/acp-event-mapper.ts +93 -6
  65. package/src/modes/components/model-selector.ts +15 -1
  66. package/src/modes/components/notifications-settings-editor.ts +1 -1
  67. package/src/modes/components/queue-pane.ts +55 -9
  68. package/src/modes/components/queued-message-selector.ts +53 -10
  69. package/src/modes/components/tool-status-header.ts +1 -4
  70. package/src/modes/components/welcome.ts +18 -3
  71. package/src/modes/controllers/command-controller.ts +4 -0
  72. package/src/modes/controllers/extension-ui-controller.ts +4 -10
  73. package/src/modes/controllers/input-controller.ts +44 -3
  74. package/src/modes/interactive-mode.ts +65 -26
  75. package/src/modes/runtime-init.ts +1 -0
  76. package/src/prompts/agents/executor.md +1 -1
  77. package/src/runtime/memory-domain.ts +66 -0
  78. package/src/runtime/memory-guard-contract.ts +73 -0
  79. package/src/runtime/memory-guard.ts +292 -0
  80. package/src/runtime/memory-limit.ts +50 -0
  81. package/src/runtime-mcp/manager.ts +26 -6
  82. package/src/sdk/acp/adapter.ts +8 -1
  83. package/src/sdk/acp/final-text.ts +40 -0
  84. package/src/sdk/acp/mcp.ts +26 -0
  85. package/src/sdk/broker/lifecycle.ts +82 -1
  86. package/src/sdk/bus/chat-daemon-cli.ts +2 -2
  87. package/src/sdk/bus/chat-daemon-control.ts +4 -3
  88. package/src/sdk/bus/config.ts +1 -1
  89. package/src/sdk/bus/index.ts +162 -22
  90. package/src/sdk/bus/rate-limit-pool.ts +8 -0
  91. package/src/sdk/bus/telegram-daemon-contract.ts +6 -4
  92. package/src/sdk/bus/telegram-daemon.ts +531 -53
  93. package/src/sdk/host/control/dispatch.ts +2 -0
  94. package/src/sdk/host/control/operations.ts +1 -0
  95. package/src/sdk/host/host.ts +2 -2
  96. package/src/sdk/lifecycle-session.ts +19 -3
  97. package/src/sdk/protocol/operation-inventory.generated.json +47 -0
  98. package/src/sdk/protocol/operation-registry.ts +1 -0
  99. package/src/sdk/session.ts +12 -1
  100. package/src/sdk/startup-capability.ts +6 -0
  101. package/src/session/agent-session.ts +256 -142
  102. package/src/session/fallback-chain-controller.ts +47 -8
  103. package/src/session/internal/managed-session-scope.ts +40 -10
  104. package/src/session/internal/native-publish-outcome.ts +8 -3
  105. package/src/session/session-manager.ts +608 -25
  106. package/src/task/executor.ts +11 -3
  107. package/src/task/index.ts +2 -0
  108. package/src/task/types.ts +22 -11
  109. package/src/task/ultragoal-redteam-activation.ts +75 -0
  110. package/src/tools/resource-gc.ts +496 -120
  111. package/src/workflow/workflow-intent-diff.ts +4 -1
@@ -0,0 +1,39 @@
1
+ import type { Settings } from "../config/settings";
2
+ import type { MemoryGuardDecision, MemoryGuardDomainSnapshot, MemoryGuardPolicy, MemoryGuardSchedulerState } from "./memory-guard-contract";
3
+ type WorkOwner = {
4
+ generation: number;
5
+ source: "timer" | "external";
6
+ };
7
+ export interface MemoryGuardHostRegistration {
8
+ ownerId: string;
9
+ intervalMs: number;
10
+ }
11
+ export interface MemoryGuardHostOptions {
12
+ run: () => Promise<void>;
13
+ logDebug?: (message: string, meta?: Record<string, unknown>) => void;
14
+ schedulerNow?: () => number;
15
+ }
16
+ export declare function resolveMemoryGuardPolicy(settings: Settings): MemoryGuardPolicy;
17
+ export declare function chooseMemoryGuardAction(input: {
18
+ domain: MemoryGuardDomainSnapshot;
19
+ hostSupported: boolean;
20
+ workerSupported: (workerId: string) => boolean;
21
+ }): MemoryGuardDecision;
22
+ export declare function revalidateMemoryGuardAction(previous: Extract<MemoryGuardDecision, {
23
+ kind: "execute";
24
+ }>, revalidated: MemoryGuardDecision): MemoryGuardDecision;
25
+ export declare class MemoryGuardHost {
26
+ #private;
27
+ constructor(options: MemoryGuardHostOptions);
28
+ register(registration: MemoryGuardHostRegistration): () => void;
29
+ updateInterval(ownerId: string, intervalMs: number): void;
30
+ runTick(generation?: number, source?: WorkOwner["source"]): Promise<void>;
31
+ runTimerCallbackForTest(owner: {
32
+ generation: number;
33
+ token: number;
34
+ }, deadline: number): Promise<void>;
35
+ setSchedulerNowForTest(now: () => number): void;
36
+ getStateForTest(): MemoryGuardSchedulerState;
37
+ resetForTest(): void;
38
+ }
39
+ export {};
@@ -0,0 +1,11 @@
1
+ export interface EffectiveMemoryLimitInput {
2
+ hardCapBytes?: number | null;
3
+ policyLimitBytes?: number | null;
4
+ }
5
+ export interface EffectiveMemoryLimit {
6
+ hardCapBytes: number | null;
7
+ policyLimitBytes: number | null;
8
+ effectiveBytes: number | null;
9
+ source: "none" | "hard_cap" | "policy_limit" | "hard_cap_and_policy_limit";
10
+ }
11
+ export declare function resolveEffectiveMemoryLimit(input: EffectiveMemoryLimitInput): EffectiveMemoryLimit;
@@ -5,6 +5,7 @@ import type { AuthStorage } from "../session/auth-storage";
5
5
  import type { MCPToolDetails } from "./tool-bridge";
6
6
  import type { MCPToolCache } from "./tool-cache";
7
7
  import type { MCPGetPromptResult, MCPPrompt, MCPRequestOptions, MCPResource, MCPResourceReadResult, MCPResourceTemplate, MCPServerConfig, MCPServerConnection } from "./types";
8
+ export declare function resolveStartupTimeoutMs(configs: MCPServerConfig[], maxStartupTimeoutMs?: number): number;
8
9
  /**
9
10
  * Stable, total ordering on MCP tools by name.
10
11
  *
@@ -48,6 +49,13 @@ export interface MCPDiscoverOptions {
48
49
  export interface MCPManagerOptions {
49
50
  /** Restrict this instance to tools from an explicit MCP config. */
50
51
  toolsOnly?: boolean;
52
+ /**
53
+ * Ceiling for the startup wait, in milliseconds. Only ACP lifecycle launches
54
+ * set this, so a slow ACP MCP handshake gets the readiness budget while every
55
+ * other consumer keeps the short default. Non-positive or non-finite values
56
+ * are ignored and the default applies.
57
+ */
58
+ maxStartupTimeoutMs?: number;
51
59
  }
52
60
  /**
53
61
  * MCP Server Manager.
@@ -0,0 +1,19 @@
1
+ export declare const ACP_FINAL_TEXT_LIMIT = 100000;
2
+ export interface BoundedAcpFinalText {
3
+ text: string;
4
+ truncated: boolean;
5
+ }
6
+ export type AcpFinalTextResolution = {
7
+ kind: "none";
8
+ final: BoundedAcpFinalText;
9
+ } | {
10
+ kind: "emit";
11
+ final: BoundedAcpFinalText;
12
+ text: string;
13
+ } | {
14
+ kind: "divergent";
15
+ final: BoundedAcpFinalText;
16
+ };
17
+ export declare function boundAcpFinalText(value: string): BoundedAcpFinalText;
18
+ export declare function acpFinalTextFromMessage(message: unknown): BoundedAcpFinalText;
19
+ export declare function resolveAcpFinalText(streamed: string, finalText: string): AcpFinalTextResolution;
@@ -0,0 +1,23 @@
1
+ export declare const ACP_MCP_REQUEST_TIMEOUT_MS = 30000;
2
+ export declare const ACP_MCP_LIFECYCLE_TIMEOUT_MS: number;
3
+ /**
4
+ * Slice of the readiness budget reserved for the work that follows MCP startup
5
+ * (session wiring, marker publication). The ACP MCP startup ceiling is the
6
+ * remaining time to `semanticReadyDeadlineAt` minus this headroom, so a slow
7
+ * MCP handshake cannot consume the whole readiness window.
8
+ */
9
+ export declare const ACP_MCP_STARTUP_HEADROOM_MS = 250;
10
+ export interface SessionLifecycleMcpStdioServer {
11
+ type?: "stdio";
12
+ name: string;
13
+ command: string;
14
+ args: string[];
15
+ env?: Record<string, string>;
16
+ }
17
+ export interface SessionLifecycleMcpRemoteServer {
18
+ type: "http" | "sse";
19
+ name: string;
20
+ url: string;
21
+ headers?: Record<string, string>;
22
+ }
23
+ export type SessionLifecycleMcpServer = SessionLifecycleMcpStdioServer | SessionLifecycleMcpRemoteServer;
@@ -1,3 +1,4 @@
1
+ import type { SessionLifecycleMcpServer } from "../acp/mcp";
1
2
  import type { SdkStartupFailure, SdkStartupRollbackResult } from "../startup-capability";
2
3
  import type { Broker, BrokerCleanupEvidence, BrokerResponse } from "./broker";
3
4
  import type { LifecycleDurableEffectsReceipt, LifecycleStartupFailureReceipt } from "./lifecycle-ledger";
@@ -61,6 +62,7 @@ export interface SessionLifecycleLaunchRequest {
61
62
  /** Broker-issued effect marker which the child echoes only after host readiness. */
62
63
  effectMarker?: string;
63
64
  modelPreset?: string;
65
+ mcpServers?: SessionLifecycleMcpServer[];
64
66
  worktree?: SessionLifecycleWorktreeTarget;
65
67
  receivedAt: number;
66
68
  requestedReadinessTimeoutMs: number;
@@ -15,7 +15,8 @@ export type ChatDaemonAction = "stop" | "reload";
15
15
  * concrete detached quarantine plus a proven-absent canonical lock pathname —
16
16
  * when deleting an observed owner-lock lease. Generation 12 refreshes retained
17
17
  * native path and process authority semantics. Generation 13 rejects special
18
- * files before retained native authority opens.
18
+ * files before retained native authority opens. Generation 14 reloads shared
19
+ * chat daemons after notification configuration parsing changes.
19
20
  */
20
21
  export declare const CHAT_DAEMON_GENERATIONS: Readonly<Record<ChatDaemonKind, number>>;
21
22
  export declare function chatDaemonGeneration(kind: ChatDaemonKind): number;
@@ -374,6 +374,7 @@ interface SessionRuntime {
374
374
  sessionId: string;
375
375
  commandId?: string;
376
376
  turnId?: string;
377
+ finalText?: string;
377
378
  } | {
378
379
  type: "agent_failed";
379
380
  sessionId: string;
@@ -423,7 +424,8 @@ interface SessionRuntime {
423
424
  /** Started tool calls awaiting a terminal activity frame, keyed by tool call id. */
424
425
  inFlightTools: Map<string, {
425
426
  toolName: string;
426
- args: unknown;
427
+ args?: unknown;
428
+ pendingPhase?: "completed" | "failed" | "cancelled";
427
429
  }>;
428
430
  /** Cancels the postmortem cleanup that emits `session_closed` on process teardown. */
429
431
  cancelPostmortemCleanup: () => void;
@@ -84,6 +84,8 @@ export declare class RateLimitPool<T = unknown> {
84
84
  constructor(options?: RateLimitPoolOptions);
85
85
  /** Number of items currently queued across all lanes. */
86
86
  get pending(): number;
87
+ /** Whether any queued item currently matches the predicate. */
88
+ someQueued(predicate: (item: RateLimitItem<T>) => boolean): boolean;
87
89
  /** Current available token count (after refill at `now`). */
88
90
  availableTokens(nowMs?: number): number;
89
91
  /**
@@ -37,11 +37,13 @@ export declare const NOTIFICATION_PROTOCOL_VERSION = 3;
37
37
  * Generation 28 rejects special files before retained native authority opens.
38
38
  * Generation 29 adds serving-epoch compatibility, sidecar heartbeat, root GC,
39
39
  * and Bot API cooldown structural fixes (#2956, #2960, #3048).
40
+ * Generation 30 adds opt-in tool activity delivery, closed lifecycle phases,
41
+ * and capability-versioned mixed-host compatibility.
40
42
  */
41
- export declare const DAEMON_GENERATION = 29;
43
+ export declare const DAEMON_GENERATION = 30;
42
44
  /**
43
45
  * Serving-compatibility boundary for daemon lifecycle requests. Epoch 1 covers
44
- * all builds published before this field existed; bump this to force serving
45
- * convergence and reload of compatible live predecessors.
46
+ * all builds published before this field existed; epoch 2 covered generation 29;
47
+ * bump this to force serving convergence and reload of compatible live predecessors.
46
48
  */
47
- export declare const SERVING_EPOCH = 2;
49
+ export declare const SERVING_EPOCH = 3;
@@ -107,8 +107,10 @@ export declare const CLIENT_PING_PONG_CAPABILITY = "client_ping_pong";
107
107
  /** Capability required for typed controls and semantic Selected acknowledgement frames. */
108
108
  export declare const ASK_SELECTED_ACK_CAPABILITY = "ask_selected_ack_v1";
109
109
  export declare const ASK_CONTROLS_CAPABILITY = "ask_controls_v1";
110
- /** Capability required for tool lifecycle and reasoning-summary frames. */
111
- export declare const TOOL_ACTIVITY_CAPABILITY = "tool_activity_v1";
110
+ /** Capability for the closed tool phase set: started, completed, failed, and cancelled. */
111
+ export declare const TOOL_ACTIVITY_CAPABILITY = "tool_activity_v2";
112
+ /** Receive-only compatibility capability for pre-v2 hosts. */
113
+ export declare const LEGACY_TOOL_ACTIVITY_CAPABILITY = "tool_activity_v1";
112
114
  /**
113
115
  * File-lock options whose acquisition budget covers the full reload-reservation
114
116
  * critical section: the in-lock freshness poll plus the controller's
@@ -752,7 +754,7 @@ export interface TelegramDaemonOptions {
752
754
  richDraft?: {
753
755
  enabled: boolean;
754
756
  };
755
- /** Tool start/completion messages (enabled by default). */
757
+ /** Tool start/completion messages (off by default; explicit opt-in only). */
756
758
  toolActivity?: {
757
759
  enabled: boolean;
758
760
  };
@@ -786,6 +788,8 @@ interface SessionSocket {
786
788
  /** True once the server advertised the `client_ping_pong` capability. */
787
789
  capable: boolean;
788
790
  ephemeralCapable: boolean;
791
+ /** Tool activity contract advertised by the connected host. */
792
+ toolActivityCapability?: "v1" | "v2";
789
793
  /** Timestamp (via opts.now) of the last received pong; seeds the TTL window. */
790
794
  lastPongAt: number;
791
795
  /** Nonce of the most recent in-flight ping, if any. */
@@ -815,6 +819,9 @@ export declare class TelegramNotificationDaemon {
815
819
  /** Endpoint-bound ownership for visible or dispatching tool bubbles. */
816
820
  private readonly toolActivityOwners;
817
821
  private readonly revokedToolEndpoints;
822
+ /** Exact settlement of each admitted legacy-v1 start; retained only while visible. */
823
+ private readonly legacyToolStarts;
824
+ private nextLegacyToolStartId;
818
825
  private readonly unresolvedToolTerminalizations;
819
826
  private toolTerminalizationChain;
820
827
  private toolActivityPolicyEpoch;
@@ -986,8 +993,21 @@ export declare class TelegramNotificationDaemon {
986
993
  private topicIdentityKey;
987
994
  private topicIdentityBase;
988
995
  private topicOwnerForIdentity;
996
+ private admitLegacyToolStart;
997
+ private legacyToolStartForTerminal;
998
+ private settleLegacyToolStart;
999
+ private cancelUnsentLegacyToolStart;
1000
+ private failLegacyToolStart;
1001
+ private settleRejectedLegacyToolSubmission;
1002
+ private cancelLegacyToolStartsForSession;
1003
+ private cleanLegacyToolStartsForCapabilityUpgrade;
1004
+ private cancelLegacyToolStartsForPolicyTransition;
989
1005
  private toolActivityOwner;
1006
+ private renderThreadedFrame;
1007
+ private toolActivityFrameWithoutSummaries;
1008
+ private toolActivitySummariesAreCurrent;
990
1009
  private toolActivityAuthorityIsCurrent;
1010
+ private toolActivityDeliveryIsCurrent;
991
1011
  private submitThreadedFrame;
992
1012
  private existingTopicForPrivateChat;
993
1013
  private topicAuthorityLease;
@@ -18,6 +18,7 @@ export interface ControlSurface {
18
18
  operateGoal(op: string, objective?: string): Promise<ControlValue> | ControlValue;
19
19
  replaceTodo(items: ControlValue): Promise<ControlValue> | ControlValue;
20
20
  setModel(id: string, thinkingLevel?: ControlValue): Promise<ControlValue> | ControlValue;
21
+ setModelProfile(id: string): Promise<ControlValue> | ControlValue;
21
22
  cycleModel(): Promise<ControlValue> | ControlValue;
22
23
  setThinking(level: ControlValue): Promise<ControlValue> | ControlValue;
23
24
  cycleThinking(): Promise<ControlValue> | ControlValue;
@@ -10,5 +10,14 @@ export type CreateLifecycleAgentSessionResult = {
10
10
  rollback: SdkStartupRollbackTracker;
11
11
  failure: SdkStartupFailure;
12
12
  };
13
+ /** Options accepted by lifecycle-only session construction. */
14
+ export type CreateLifecycleAgentSessionOptions = CreateAgentSessionOptions & {
15
+ /**
16
+ * Startup budget for ACP lifecycle MCP launches, in milliseconds. Set only
17
+ * when the lifecycle request supplies `mcpServers`; ordinary consumers keep
18
+ * the manager's short default ceiling.
19
+ */
20
+ mcpStartupTimeoutMs?: number;
21
+ };
13
22
  /** Internal lifecycle-only session construction with an owner-bound SDK startup result. */
14
- export declare function createLifecycleAgentSession(options?: CreateAgentSessionOptions): Promise<CreateLifecycleAgentSessionResult>;
23
+ export declare function createLifecycleAgentSession(options?: CreateLifecycleAgentSessionOptions): Promise<CreateLifecycleAgentSessionResult>;
@@ -16,6 +16,12 @@ export type SdkStartupResult = {
16
16
  };
17
17
  /** Internal symbols for lifecycle-only SDK startup construction and bus wiring. */
18
18
  export declare const lifecycleStartupCapabilityOption: unique symbol;
19
+ /**
20
+ * Internal option carrying the startup budget for ACP lifecycle MCP launches.
21
+ * Only set when the lifecycle request actually supplies `mcpServers`, so the
22
+ * longer ceiling never leaks to ordinary CLI/SDK `mcpConfigPath` consumers.
23
+ */
24
+ export declare const lifecycleMcpStartupTimeoutOption: unique symbol;
19
25
  export declare function attachLifecycleStartupCapability(api: object, capability: SdkStartupCapability): void;
20
26
  export declare function lifecycleStartupCapabilityForApi(api: object): SdkStartupCapability | undefined;
21
27
  export interface SdkStartupRollbackResult {
@@ -80,7 +80,7 @@ import type { TtsrManager } from "../export/ttsr";
80
80
  import type { LoadedCustomCommand } from "../extensibility/custom-commands";
81
81
  import type { CustomTool } from "../extensibility/custom-tools/types";
82
82
  import type { ExtensionRunner } from "../extensibility/extensions";
83
- import type { CompactOptions, ContextUsage } from "../extensibility/extensions/types";
83
+ import type { CompactOptions, ContextUsage, ExtensionTranscriptEntry } from "../extensibility/extensions/types";
84
84
  import { type Skill, type SkillWarning } from "../extensibility/skills";
85
85
  import { type FileSlashCommand } from "../extensibility/slash-commands";
86
86
  import { GoalRuntime } from "../goals/runtime";
@@ -102,7 +102,7 @@ export { DefaultModelSelectionRecoveryError } from "./default-model-selection";
102
102
  import type { ClientBridge, ClientBridgePermissionOption, ClientBridgePermissionOutcome, ClientBridgePermissionToolCall } from "./client-bridge";
103
103
  import { type ContributionPrepOptions, type ContributionPrepResult } from "./contribution-prep";
104
104
  import { type CustomMessage } from "./messages";
105
- import type { BranchSummaryEntry, CompactionEntry, NewSessionOptions, RecoveryHydrationContext, RecoveryHydrationPromotionFence, SessionContext, SessionManager, SessionManagerCloseOutcome } from "./session-manager";
105
+ import type { BranchSummaryEntry, CompactionEntry, NewSessionOptions, PreparedNewSession, RecoveryHydrationContext, RecoveryHydrationPromotionFence, SessionContext, SessionManager, SessionManagerCloseOutcome } from "./session-manager";
106
106
  import { ToolChoiceQueue } from "./tool-choice-queue";
107
107
  import { YieldQueue } from "./yield-queue";
108
108
  /** Session-specific events that extend the core AgentEvent */
@@ -762,6 +762,8 @@ export declare class AgentSession {
762
762
  /** Main startup calls this exactly once, after a strict open returned `kind: "opened"`. */
763
763
  continuePersistedHistory(): Promise<void>;
764
764
  buildDisplaySessionContext(): SessionContext;
765
+ /** Build display context from an unpublished successor without changing active session state. @internal */
766
+ buildPreparedDisplaySessionContext(prepared: PreparedNewSession): SessionContext;
765
767
  /** Convert session messages using the same pre-LLM pipeline as the active session. */
766
768
  convertMessagesToLlm(messages: AgentMessage[], signal?: AbortSignal): Promise<Message[]>;
767
769
  /** Apply session-level stream hooks to a direct side request. */
@@ -785,7 +787,7 @@ export declare class AgentSession {
785
787
  /** Live SDK configuration values exposed through the session query surface. */
786
788
  getSdkConfigItems(): Record<string, string>;
787
789
  setPlanModeState(state: PlanModeState | undefined): void;
788
- invokeSkill(name: string, args?: string): Promise<{
790
+ invokeSkill(name: string, args?: string, options?: Pick<PromptOptions, "onPreflightAccepted">): Promise<{
789
791
  name: string;
790
792
  path: string;
791
793
  args?: string;
@@ -793,13 +795,7 @@ export declare class AgentSession {
793
795
  }>;
794
796
  setSdkPlanMode(on: boolean): Promise<PlanModeState | undefined>;
795
797
  operateGoal(op: "create" | "get" | "resume" | "pause" | "complete" | "drop", objective?: string): Promise<unknown>;
796
- getTranscript(): Array<{
797
- id: string;
798
- role: string;
799
- textSummary: string;
800
- ts: string;
801
- body: string;
802
- }>;
798
+ getTranscript(): ExtensionTranscriptEntry[];
803
799
  getTranscriptBody(entryId: string): string | undefined;
804
800
  getGoalModeState(): GoalModeState | undefined;
805
801
  setGoalModeState(state: GoalModeState | undefined): void;
@@ -846,7 +842,7 @@ export declare class AgentSession {
846
842
  * @throws Error if no model selected or no API key available (when not streaming)
847
843
  */
848
844
  prompt(text: string, options?: PromptOptions): Promise<void>;
849
- promptCustomMessage<T = unknown>(message: Pick<CustomMessage<T>, "customType" | "content" | "display" | "details" | "attribution">, options?: Pick<PromptOptions, "streamingBehavior" | "toolChoice" | "followUpQueuePolicy">): Promise<void>;
845
+ promptCustomMessage<T = unknown>(message: Pick<CustomMessage<T>, "customType" | "content" | "display" | "details" | "attribution">, options?: Pick<PromptOptions, "streamingBehavior" | "toolChoice" | "followUpQueuePolicy" | "onPreflightAccepted">): Promise<void>;
850
846
  /**
851
847
  * Queue a steering message to interrupt the agent mid-run.
852
848
  */
@@ -988,6 +984,8 @@ export declare class AgentSession {
988
984
  }): Promise<void>;
989
985
  setActiveModelProfile(name: string | undefined): void;
990
986
  getActiveModelProfile(): string | undefined;
987
+ /** Activate a complete model profile through a nonvisual session control. */
988
+ activateModelProfileForControl(profileName: string): Promise<boolean>;
991
989
  /** Return the persisted configured fallback selectors for a model role. */
992
990
  getConfiguredModelChain(role: string): readonly string[] | undefined;
993
991
  /** Persist the configured fallback selectors for a model role. */
@@ -47,8 +47,9 @@ export declare class FallbackChainController {
47
47
  onAttemptFailure(triggerClass: FallbackTriggerClass, reason: string): FallbackFailureResult;
48
48
  advance(): boolean;
49
49
  /**
50
- * Restore the entry that just advanced when credential rotation permits a retry.
51
- * The chain-wide budget and failure history remain charged.
50
+ * Restore the entry that just advanced for one attempt with a rotated credential.
51
+ * Each non-terminal entry may be restored once, so credential rotation remains
52
+ * bounded and cannot consume the attempts reserved for downstream entries.
52
53
  */
53
54
  restorePreviousEntryForRetry(): boolean;
54
55
  isExhausted(): boolean;
@@ -56,5 +57,20 @@ export declare class FallbackChainController {
56
57
  resetSticky(): void;
57
58
  }
58
59
  export declare function cappedExponentialWithFullJitter(baseDelayMs: number, maxDelayMs: number, attemptK: number, random?: () => number): number;
60
+ /**
61
+ * Legacy auto-compaction retry delay.
62
+ *
63
+ * Deliberately the mirror image of `effectiveFallbackDelay`: this path recovers
64
+ * Retry-After by regex over provider error prose (`#parseRetryAfterMsFromError`),
65
+ * so it follows the documented legacy rule — `retry.maxDelayMs` caps every
66
+ * legacy session retry delay, including provider retry-after hints. Managed
67
+ * fallback stays uncapped because it retries within its own per-entry budget;
68
+ * compaction has no such budget, so the final candidate would otherwise sleep
69
+ * for the full server-suggested duration.
70
+ *
71
+ * `maxDelayMs <= 0` means "no cap", matching `cappedExponentialWithFullJitter`.
72
+ * A missing, NaN, or infinite hint collapses to "no usable hint".
73
+ */
74
+ export declare function compactionRetryDelay(baseDelayMs: number, maxDelayMs: number, attempt: number, retryAfterMs: number | undefined): number;
59
75
  /** Retry-After is intentionally uncapped. */
60
76
  export declare function effectiveFallbackDelay(baseDelayMs: number, maxDelayMs: number, attemptK: number, retryAfterMs: number | undefined, random?: () => number): number;
@@ -121,12 +121,39 @@ export declare function ensureManagedScope(scope: ManagedScope, policy?: Managed
121
121
  /** Synchronously create and validate the v2 binding before a default session writer exists. */
122
122
  export declare function prepareManagedSessionScopeForWriteSync(scope: ManagedScope, policy?: ManagedSessionSecurityPolicy, authority?: ManagedCandidateWriteAuthority): ManagedScopeResolution;
123
123
  export declare function listManagedCandidates(scope: ManagedScope): ManagedCandidateListing;
124
+ type DetachedArtifactRoot = {
125
+ originalPath: string;
126
+ detachedPath: string;
127
+ identity: {
128
+ dev: bigint;
129
+ ino: bigint;
130
+ size: bigint;
131
+ mtimeNs: bigint;
132
+ };
133
+ tree: NativeDirectoryTreeSnapshot;
134
+ };
124
135
  export declare function matchesMigrationArtifactRoot(pathname: string, identity: {
125
136
  dev: bigint;
126
137
  ino: bigint;
127
138
  size: bigint;
128
139
  mtimeNs: bigint;
129
140
  }, expectedTree: NativeDirectoryTreeSnapshot, platform?: NodeJS.Platform): boolean;
141
+ type SourceArtifactCleanup = {
142
+ state: "cleanup_pending";
143
+ role: "exchange_placeholder";
144
+ retainedPath: string;
145
+ identity: DetachedArtifactRoot["identity"];
146
+ tree: NativeDirectoryTreeSnapshot;
147
+ };
148
+ export declare function cleanupAuthorityMatches(cleanup: SourceArtifactCleanup, parent: string, platform?: NodeJS.Platform): boolean;
149
+ export declare function detachArtifactRootForMigration(plan: DetachedArtifactRoot, platform?: NodeJS.Platform): {
150
+ detached: DetachedArtifactRoot;
151
+ detachOutcome: "clean";
152
+ } | {
153
+ detached: DetachedArtifactRoot;
154
+ detachOutcome: "cleanup_pending";
155
+ cleanup: SourceArtifactCleanup;
156
+ };
130
157
  export declare function restorePreparedArtifactRoot(scope: ManagedScope, source: ManagedCandidate, lock?: ManagedStorageLock): void;
131
158
  /** Resume tombstoned cleanup under its original operation lease without restoring retired candidates. */
132
159
  export declare function reconcileManagedTombstones(scope: ManagedScope, expectedCandidate?: ManagedCandidate): Promise<void>;
@@ -27,6 +27,13 @@ export interface NewSessionOptions {
27
27
  /** Skip flushing the current session and delete it instead of saving. */
28
28
  drop?: boolean;
29
29
  }
30
+ /** Internal successor prepared without changing the manager's visible identity. */
31
+ export interface PreparedNewSession {
32
+ readonly sessionId: string;
33
+ readonly sessionFile: string | undefined;
34
+ readonly artifactsDir: string | null;
35
+ readonly managedLegacyLocalMigrationSource: ManagedLegacyLocalMigrationSource | null;
36
+ }
30
37
  export interface SessionEntryBase {
31
38
  type: string;
32
39
  id: string;
@@ -597,6 +604,33 @@ export declare class SessionManager {
597
604
  setSessionFile(sessionFile: string): Promise<void>;
598
605
  /** Start a new session. Closes any existing writer first. */
599
606
  newSession(options?: NewSessionOptions): Promise<string | undefined>;
607
+ /**
608
+ * Allocate a fresh successor without publishing it through the manager's public
609
+ * getters. The returned authority is deliberately immutable so readiness work
610
+ * can resolve local:// against the successor while the predecessor stays live.
611
+ * @internal
612
+ */
613
+ prepareNewSession(options?: NewSessionOptions): Promise<PreparedNewSession>;
614
+ /** Append a model selection to an unpublished successor. @internal */
615
+ appendPreparedModelChange(prepared: PreparedNewSession, model: string): string;
616
+ /** Append a thinking-level selection to an unpublished successor. @internal */
617
+ appendPreparedThinkingLevelChange(prepared: PreparedNewSession, thinkingLevel?: string): string;
618
+ /** Append a service-tier selection to an unpublished successor. @internal */
619
+ appendPreparedServiceTierChange(prepared: PreparedNewSession, serviceTier: ServiceTier | null): string;
620
+ /** Append a displayable custom message to an unpublished successor. @internal */
621
+ appendPreparedCustomMessageEntry<T = unknown>(prepared: PreparedNewSession, customType: string, content: string | (TextContent | ImageContent)[], display: boolean, details?: T, attribution?: MessageAttribution): string;
622
+ /** Persist an unpublished successor without adopting it. @internal */
623
+ ensurePreparedNewSessionOnDisk(prepared: PreparedNewSession): Promise<void>;
624
+ /** Build context from an unpublished successor without reading active manager state. @internal */
625
+ buildPreparedNewSessionContext(prepared: PreparedNewSession): SessionContext;
626
+ /** Prepare a forked successor without publishing it through public manager state. @internal */
627
+ prepareFork(): Promise<PreparedNewSession | undefined>;
628
+ /** Prepare a path-only branch successor without publishing it through public manager state. @internal */
629
+ prepareBranchedSession(leafId: string): Promise<PreparedNewSession>;
630
+ /** Publish a prepared successor synchronously after all readiness awaits succeed. @internal */
631
+ commitPreparedNewSession(prepared: PreparedNewSession): void;
632
+ /** Exact-discard only an uncommitted successor prepared by this manager. @internal */
633
+ discardPreparedNewSession(prepared: PreparedNewSession): Promise<void>;
600
634
  /** Tombstone and exact-delete managed transcripts, detaching the active transcript first. */
601
635
  dropSession(sessionPath: string): Promise<void>;
602
636
  /**
@@ -20,6 +20,7 @@ import type { ContextFileEntry } from "../tools";
20
20
  import type { EventBus } from "../utils/event-bus";
21
21
  import type { WorkspaceTree } from "../workspace-tree";
22
22
  import { type AgentDefinition, type AgentProgress, type ReviewFinding, type SingleResult } from "./types";
23
+ import { type ExecutorExecutionMode } from "./ultragoal-redteam-activation";
23
24
  export declare function trimForkContextSeedForModel(seed: ForkContextSeed, model: Model | undefined): ForkContextSeed;
24
25
  /** Options for subagent execution */
25
26
  export interface ExecutorOptions {
@@ -28,6 +29,11 @@ export interface ExecutorOptions {
28
29
  agent: AgentDefinition;
29
30
  task: string;
30
31
  assignment?: string;
32
+ /**
33
+ * Typed executor execution mode. When set, overrides assignment-text heuristics
34
+ * for ultragoal red-team prompt injection (#2698 / #2456).
35
+ */
36
+ executionMode?: ExecutorExecutionMode;
31
37
  context?: string;
32
38
  description?: string;
33
39
  index: number;
@@ -45,6 +45,10 @@ export declare const taskItemSchema: z.ZodObject<{
45
45
  id: z.ZodString;
46
46
  description: z.ZodString;
47
47
  assignment: z.ZodString;
48
+ executionMode: z.ZodOptional<z.ZodEnum<{
49
+ default: "default";
50
+ "ultragoal-red-team": "ultragoal-red-team";
51
+ }>>;
48
52
  inheritContext: z.ZodOptional<z.ZodEnum<{
49
53
  bounded: "bounded";
50
54
  full: "full";
@@ -69,6 +73,10 @@ export declare const taskSchema: z.ZodObject<{
69
73
  id: z.ZodString;
70
74
  description: z.ZodString;
71
75
  assignment: z.ZodString;
76
+ executionMode: z.ZodOptional<z.ZodEnum<{
77
+ default: "default";
78
+ "ultragoal-red-team": "ultragoal-red-team";
79
+ }>>;
72
80
  inheritContext: z.ZodOptional<z.ZodEnum<{
73
81
  bounded: "bounded";
74
82
  full: "full";
@@ -100,6 +108,10 @@ export declare const taskSchemaNoIsolation: z.ZodObject<{
100
108
  id: z.ZodString;
101
109
  description: z.ZodString;
102
110
  assignment: z.ZodString;
111
+ executionMode: z.ZodOptional<z.ZodEnum<{
112
+ default: "default";
113
+ "ultragoal-red-team": "ultragoal-red-team";
114
+ }>>;
103
115
  inheritContext: z.ZodOptional<z.ZodEnum<{
104
116
  bounded: "bounded";
105
117
  full: "full";
@@ -131,6 +143,10 @@ declare const ALL_TASK_SCHEMAS: readonly [z.ZodObject<{
131
143
  id: z.ZodString;
132
144
  description: z.ZodString;
133
145
  assignment: z.ZodString;
146
+ executionMode: z.ZodOptional<z.ZodEnum<{
147
+ default: "default";
148
+ "ultragoal-red-team": "ultragoal-red-team";
149
+ }>>;
134
150
  inheritContext: z.ZodOptional<z.ZodEnum<{
135
151
  bounded: "bounded";
136
152
  full: "full";
@@ -161,6 +177,10 @@ declare const ALL_TASK_SCHEMAS: readonly [z.ZodObject<{
161
177
  id: z.ZodString;
162
178
  description: z.ZodString;
163
179
  assignment: z.ZodString;
180
+ executionMode: z.ZodOptional<z.ZodEnum<{
181
+ default: "default";
182
+ "ultragoal-red-team": "ultragoal-red-team";
183
+ }>>;
164
184
  inheritContext: z.ZodOptional<z.ZodEnum<{
165
185
  bounded: "bounded";
166
186
  full: "full";
@@ -191,6 +211,10 @@ declare const ALL_TASK_SCHEMAS: readonly [z.ZodObject<{
191
211
  id: z.ZodString;
192
212
  description: z.ZodString;
193
213
  assignment: z.ZodString;
214
+ executionMode: z.ZodOptional<z.ZodEnum<{
215
+ default: "default";
216
+ "ultragoal-red-team": "ultragoal-red-team";
217
+ }>>;
194
218
  inheritContext: z.ZodOptional<z.ZodEnum<{
195
219
  bounded: "bounded";
196
220
  full: "full";
@@ -221,6 +245,10 @@ declare const ALL_TASK_SCHEMAS: readonly [z.ZodObject<{
221
245
  id: z.ZodString;
222
246
  description: z.ZodString;
223
247
  assignment: z.ZodString;
248
+ executionMode: z.ZodOptional<z.ZodEnum<{
249
+ default: "default";
250
+ "ultragoal-red-team": "ultragoal-red-team";
251
+ }>>;
224
252
  inheritContext: z.ZodOptional<z.ZodEnum<{
225
253
  bounded: "bounded";
226
254
  full: "full";
@@ -251,6 +279,10 @@ declare const ALL_TASK_SCHEMAS: readonly [z.ZodObject<{
251
279
  id: z.ZodString;
252
280
  description: z.ZodString;
253
281
  assignment: z.ZodString;
282
+ executionMode: z.ZodOptional<z.ZodEnum<{
283
+ default: "default";
284
+ "ultragoal-red-team": "ultragoal-red-team";
285
+ }>>;
254
286
  inheritContext: z.ZodOptional<z.ZodEnum<{
255
287
  bounded: "bounded";
256
288
  full: "full";
@@ -281,6 +313,10 @@ declare const ALL_TASK_SCHEMAS: readonly [z.ZodObject<{
281
313
  id: z.ZodString;
282
314
  description: z.ZodString;
283
315
  assignment: z.ZodString;
316
+ executionMode: z.ZodOptional<z.ZodEnum<{
317
+ default: "default";
318
+ "ultragoal-red-team": "ultragoal-red-team";
319
+ }>>;
284
320
  inheritContext: z.ZodOptional<z.ZodEnum<{
285
321
  bounded: "bounded";
286
322
  full: "full";
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Decide whether an executor assignment should inject the ultragoal red-team
3
+ * prompt fragment.
4
+ *
5
+ * Preference order (parse, don't re-validate later):
6
+ * 1. Explicit typed `executionMode` on the task / ExecutorOptions — authoritative.
7
+ * 2. Assignment text heuristics — only explicit Ultragoal QA/red-team phrasing.
8
+ *
9
+ * Bare mentions of `executorQa` (docs, quality-gate field names, negative
10
+ * instructions) must not flip the mode (#2698 / #2456).
11
+ *
12
+ * Mirrors `executor.md`:
13
+ * "activates only when the assignment explicitly labels Executor as Ultragoal
14
+ * completion QA/red-team or asks for `executorQa` red-team evidence."
15
+ */
16
+ export declare const EXECUTOR_EXECUTION_MODES: readonly ["default", "ultragoal-red-team"];
17
+ export type ExecutorExecutionMode = (typeof EXECUTOR_EXECUTION_MODES)[number];
18
+ export declare function isExecutorExecutionMode(value: unknown): value is ExecutorExecutionMode;
19
+ /**
20
+ * Parse a caller-supplied mode. Unknown values fail closed to `undefined`
21
+ * so the assignment heuristic (or default off) still applies — never invent on.
22
+ */
23
+ export declare function parseExecutorExecutionMode(value: unknown): ExecutorExecutionMode | undefined;
24
+ export declare function assignmentRequestsUltragoalRedTeam(assignment: string | undefined): boolean;
25
+ export interface ResolveUltragoalRedTeamArgs {
26
+ readonly executionMode?: unknown;
27
+ readonly assignment?: string;
28
+ }
29
+ /**
30
+ * Final activation decision for the executor prompt fragment.
31
+ * Typed mode wins; assignment text is a compatibility fallback only.
32
+ */
33
+ export declare function resolveUltragoalRedTeamActivation(args: ResolveUltragoalRedTeamArgs): boolean;