@squidcloud/backend 1.0.485 → 1.0.486

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.
@@ -33,6 +33,8 @@ export declare class ClaudeCodeCliAdapter implements AgentCliSessionAdapter {
33
33
  readonly maxBlobBytes: number;
34
34
  /** Stored between buildArgs and afterRun so we can clean up the MCP session. */
35
35
  private mcpSessionId;
36
+ /** Tracks the root status while the process lifecycle is active. */
37
+ private readonly rootStatus;
36
38
  /** Creates a Claude adapter for one request. */
37
39
  constructor(deps: CliAgentAdapterDeps);
38
40
  /**
@@ -63,6 +65,8 @@ export declare class ClaudeCodeCliAdapter implements AgentCliSessionAdapter {
63
65
  statePaths(_ctx: SessionCtx): string[];
64
66
  /** Parses Claude stream-json output into a terminal response. */
65
67
  parseOutput(stdout: Readable, stderr: Readable, prompt: string): Promise<CliRunOutcome>;
68
+ /** Publishes the terminal replacement selected by the process lifecycle. */
69
+ completeRun(outcome: CliRunOutcome): void;
66
70
  /** Deletes temporary MCP and working-directory state. */
67
71
  afterRun(ctx: SessionCtx): Promise<void>;
68
72
  /**
@@ -48,6 +48,19 @@ export interface CreateAgentToolsSessionResponse {
48
48
  /** Locates the session-specific MCP endpoint. */
49
49
  mcpUrl: string;
50
50
  }
51
+ /** Describes one observable CLI activity update. */
52
+ export interface CliAgentStatusUpdate {
53
+ /** Identifies an update so later events can replace it in place. */
54
+ messageId?: string;
55
+ /** Supplies the short activity label. */
56
+ title: string;
57
+ /** Supplies Markdown-formatted activity details. */
58
+ body: string;
59
+ /** Nests this activity beneath another status update. */
60
+ parentStatusUpdateId?: string;
61
+ /** Supplies optional machine-readable activity metadata. */
62
+ tags?: Record<string, unknown>;
63
+ }
51
64
  /** Supplies per-request services and settings to a CLI adapter. */
52
65
  export interface CliAgentAdapterDeps {
53
66
  /** Contains the model and per-request AI options. */
@@ -75,6 +88,8 @@ export interface CliAgentAdapterDeps {
75
88
  restrictedSettingsPath?: string;
76
89
  /** Overrides the tools exposed to Claude inside an explicitly restricted run. */
77
90
  restrictedTools?: string;
91
+ /** Constrains Claude's terminal response to one validated JSON value. */
92
+ structuredOutputSchema?: Record<string, unknown>;
78
93
  /** Routes restricted Codex through the source model proxy by default; set to false for direct local development. */
79
94
  useSourceModelProxy?: boolean;
80
95
  /** Uses the CLI's read-only host sandbox when no outer source-agent jail is available locally. */
@@ -85,13 +100,8 @@ export interface CliAgentAdapterDeps {
85
100
  createMcpSession(): Promise<CreateAgentToolsSessionResponse>;
86
101
  /** Deletes a temporary MCP session after the run. */
87
102
  deleteMcpSession(sessionId: string): Promise<void>;
88
- /** Publishes a bounded progress update for the run. */
89
- publishStatus?(update: {
90
- title: string;
91
- body: string;
92
- parentStatusUpdateId?: string;
93
- tags?: Record<string, unknown>;
94
- }): void;
103
+ /** Publishes an observable activity update for the run. */
104
+ publishStatus?(update: CliAgentStatusUpdate): void;
95
105
  }
96
106
  /** Describes one supported CLI without owning its process lifecycle. */
97
107
  export interface AgentCliSessionAdapter {
@@ -117,6 +127,8 @@ export interface AgentCliSessionAdapter {
117
127
  statePaths(ctx: SessionCtx): string[];
118
128
  /** Parses bounded process streams into a terminal outcome. */
119
129
  parseOutput(stdout: Readable, stderr: Readable, prompt: string): Promise<CliRunOutcome>;
130
+ /** Publishes the terminal run status after the process lifecycle selects its final outcome. */
131
+ completeRun(outcome: CliRunOutcome): void;
120
132
  /** Releases provider-specific resources after the process exits. */
121
133
  afterRun?(ctx: SessionCtx): Promise<void>;
122
134
  }
@@ -0,0 +1,25 @@
1
+ import { CliAgentStatusUpdate, CliRunOutcome } from './cli-agent-adapter.types';
2
+ /** Configures the root status shared by CLI-agent adapters. */
3
+ export interface CliAgentRootStatusOptions {
4
+ /** Supplies the provider name shown to users. */
5
+ displayName: string;
6
+ /** Formats provider-specific errors for display. */
7
+ formatError(error: string): string;
8
+ /** Supplies the run bound for timeout status text. */
9
+ maxWallTimeMs(): number;
10
+ /** Publishes status updates when the caller requested them. */
11
+ publishStatus?(update: CliAgentStatusUpdate): void;
12
+ }
13
+ /** Owns one CLI run's root status lifecycle and accumulated token usage. */
14
+ export declare class CliAgentRootStatus {
15
+ private readonly options;
16
+ private active;
17
+ /** Creates a root-status lifecycle for one adapter instance. */
18
+ constructor(options: CliAgentRootStatusOptions);
19
+ /** Starts tracking the root status published by the adapter parser. */
20
+ begin(messageId: string): void;
21
+ /** Records the latest cumulative token usage for the terminal replacement. */
22
+ recordUsage(inputTokens: number, outputTokens: number): void;
23
+ /** Publishes one terminal replacement after the process runner selects its final outcome. */
24
+ complete(outcome: CliRunOutcome): void;
25
+ }
@@ -0,0 +1,9 @@
1
+ /** Contains compact user-visible details for one CLI tool invocation. */
2
+ export interface CompactToolActivity {
3
+ /** Supplies the Markdown body shown when the tool invocation is expanded. */
4
+ body: string;
5
+ /** Supplies the single-line description shown in a collapsed tool group. */
6
+ summary: string;
7
+ }
8
+ /** Formats common CLI tool arguments without exposing tool output or internal workspace prefixes. */
9
+ export declare function formatCompactToolActivity(toolName: string, input: Record<string, unknown> | undefined): CompactToolActivity;
@@ -36,6 +36,8 @@ export declare class CodexCliAdapter implements AgentCliSessionAdapter {
36
36
  private mcpSessionId;
37
37
  /** Per-run MCP bearer token; captured in buildArgs, exposed to the CLI via buildEnv. */
38
38
  private mcpBearerToken;
39
+ /** Tracks the root status while the process lifecycle is active. */
40
+ private readonly rootStatus;
39
41
  /** Creates a Codex adapter for one request. */
40
42
  constructor(deps: CliAgentAdapterDeps);
41
43
  /**
@@ -59,6 +61,8 @@ export declare class CodexCliAdapter implements AgentCliSessionAdapter {
59
61
  statePaths(_ctx: SessionCtx): string[];
60
62
  /** Parses Codex JSONL output into a terminal response. */
61
63
  parseOutput(stdout: Readable, stderr: Readable, prompt: string): Promise<CliRunOutcome>;
64
+ /** Publishes the terminal replacement selected by the process lifecycle. */
65
+ completeRun(outcome: CliRunOutcome): void;
62
66
  /** Deletes temporary MCP and working-directory state. */
63
67
  afterRun(ctx: SessionCtx): Promise<void>;
64
68
  /** Writes the captured thread id into the sidecar so it round-trips with the session blob. */
@@ -2,6 +2,9 @@ export * from './claude-code.adapter';
2
2
  export * from './cli-agent-adapter.types';
3
3
  export * from './cli-agent-process-launcher';
4
4
  export * from './cli-agent-process-runner';
5
+ export * from './cli-agent-root-status';
6
+ export * from './cli-agent-status.utils';
7
+ export * from './cli-output-stream.utils';
5
8
  export * from './codex.adapter';
6
9
  export * from './nsjail-source-process-launcher';
7
10
  export * from './workspace.utils';
@@ -1,4 +1,5 @@
1
1
  import { CanonicalReasoningEffort, SourceCodeAnalyzerModel, SourceControlProvider } from '@squidcloud/client';
2
+ import { CliAgentStatusUpdate } from '../cli-agent/cli-agent-adapter.types';
2
3
  import { CliAgentProcessLauncher } from '../cli-agent/cli-agent-process-launcher';
3
4
  import { CliAgentProcessRunner } from '../cli-agent/cli-agent-process-runner';
4
5
  import { NsjailSourceProcessLauncherConfig } from '../cli-agent/nsjail-source-process-launcher';
@@ -42,6 +43,8 @@ export interface RestrictedSourceRunRequest {
42
43
  signal: AbortSignal;
43
44
  /** Requests a timeout no greater than the deployment ceiling. */
44
45
  timeoutMs: number;
46
+ /** Publishes observable analyzer activity to the calling AI session. */
47
+ publishStatus?: (update: CliAgentStatusUpdate) => void;
45
48
  }
46
49
  /** Contains the user-visible response and model usage for one restricted run. */
47
50
  export interface RestrictedSourceRunResult {
@@ -1,4 +1,5 @@
1
1
  import { type AiAgentSourceCodeIntegrationOptions, type AnalyzeCodeRequest, type AnalyzeCodeResult } from '@squidcloud/client';
2
+ import type { CliAgentStatusUpdate } from '../cli-agent/cli-agent-adapter.types';
2
3
  import { RestrictedSourceRunRequest, RestrictedSourceRunResult } from './restricted-source-runner';
3
4
  import { type SourceAnalysisAdmissionControllerLike } from './source-analysis-admission-controller';
4
5
  import { SourceCodeLimits } from './source-code-limits';
@@ -22,6 +23,8 @@ export interface SourceCodeAnalyzeInput {
22
23
  analyzerApiKey: string;
23
24
  /** Supplies repository authorization and provider reads. */
24
25
  adapter: SourceProviderAdapter;
26
+ /** Publishes observable analyzer activity to the calling AI session. */
27
+ publishStatus?: (update: CliAgentStatusUpdate) => void;
25
28
  }
26
29
  /** Represents the restricted runner boundary used by orchestration tests. */
27
30
  export interface RestrictedSourceRunnerLike {
@@ -1,6 +1,86 @@
1
1
  import type { AnalyzeCodeResult } from '@squidcloud/client';
2
2
  import { SourceGitCommand } from './source-git-command';
3
3
  import type { PreparedSourceWorkspace } from './source-workspace-manager';
4
+ /**
5
+ * Constrains source analyzers to the evidence envelope accepted by the verifier. The
6
+ * `parseAnalyzerOutput` implementation below remains authoritative for validation.
7
+ */
8
+ export declare const SOURCE_ANALYZER_OUTPUT_JSON_SCHEMA: {
9
+ readonly additionalProperties: false;
10
+ readonly properties: {
11
+ readonly answer: {
12
+ readonly type: "string";
13
+ };
14
+ readonly repositories: {
15
+ readonly items: {
16
+ readonly additionalProperties: false;
17
+ readonly properties: {
18
+ readonly commitSha: {
19
+ readonly pattern: "^[a-f0-9]{40}$";
20
+ readonly type: "string";
21
+ };
22
+ readonly paths: {
23
+ readonly items: {
24
+ readonly additionalProperties: false;
25
+ readonly properties: {
26
+ readonly lines: {
27
+ readonly additionalProperties: false;
28
+ readonly properties: {
29
+ readonly end: {
30
+ readonly minimum: 1;
31
+ readonly type: "integer";
32
+ };
33
+ readonly start: {
34
+ readonly minimum: 1;
35
+ readonly type: "integer";
36
+ };
37
+ };
38
+ readonly required: readonly ["end", "start"];
39
+ readonly type: "object";
40
+ };
41
+ readonly path: {
42
+ readonly type: "string";
43
+ };
44
+ };
45
+ readonly required: readonly ["path"];
46
+ readonly type: "object";
47
+ };
48
+ readonly minItems: 1;
49
+ readonly type: "array";
50
+ };
51
+ readonly ref: {
52
+ readonly additionalProperties: false;
53
+ readonly properties: {
54
+ readonly name: {
55
+ readonly type: "string";
56
+ };
57
+ readonly type: {
58
+ readonly enum: readonly ["branch", "tag", "commit"];
59
+ readonly type: "string";
60
+ };
61
+ };
62
+ readonly required: readonly ["name", "type"];
63
+ readonly type: "object";
64
+ };
65
+ readonly repository: {
66
+ readonly type: "string";
67
+ };
68
+ };
69
+ readonly required: readonly ["commitSha", "paths", "ref", "repository"];
70
+ readonly type: "object";
71
+ };
72
+ readonly type: "array";
73
+ };
74
+ readonly warnings: {
75
+ readonly items: {
76
+ readonly type: "string";
77
+ };
78
+ readonly type: "array";
79
+ };
80
+ };
81
+ readonly required: readonly ["answer", "repositories", "warnings"];
82
+ readonly type: "object";
83
+ };
4
84
  /** Supplies trusted state and one bounded analyzer response for verification. */
5
85
  export interface VerifySourceEvidenceInput {
6
86
  /** Contains exactly one analyzer JSON object. */