@bradygaster/squad-sdk 0.7.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +296 -296
- package/dist/adapter/client.d.ts +225 -0
- package/dist/adapter/client.d.ts.map +1 -0
- package/dist/adapter/client.js +397 -0
- package/dist/adapter/client.js.map +1 -0
- package/dist/adapter/errors.d.ts +260 -0
- package/dist/adapter/errors.d.ts.map +1 -0
- package/dist/adapter/errors.js +362 -0
- package/dist/adapter/errors.js.map +1 -0
- package/dist/adapter/types.d.ts +779 -0
- package/dist/adapter/types.d.ts.map +1 -0
- package/dist/adapter/types.js +11 -0
- package/dist/adapter/types.js.map +1 -0
- package/dist/agents/charter-compiler.d.ts +102 -0
- package/dist/agents/charter-compiler.d.ts.map +1 -0
- package/dist/agents/charter-compiler.js +157 -0
- package/dist/agents/charter-compiler.js.map +1 -0
- package/dist/agents/history-shadow.d.ts +80 -0
- package/dist/agents/history-shadow.d.ts.map +1 -0
- package/dist/agents/history-shadow.js +239 -0
- package/dist/agents/history-shadow.js.map +1 -0
- package/dist/agents/index.d.ts +68 -0
- package/dist/agents/index.d.ts.map +1 -0
- package/dist/agents/index.js +74 -0
- package/dist/agents/index.js.map +1 -0
- package/dist/agents/lifecycle.d.ts +138 -0
- package/dist/agents/lifecycle.d.ts.map +1 -0
- package/dist/agents/lifecycle.js +258 -0
- package/dist/agents/lifecycle.js.map +1 -0
- package/dist/agents/model-selector.d.ts +80 -0
- package/dist/agents/model-selector.d.ts.map +1 -0
- package/dist/agents/model-selector.js +198 -0
- package/dist/agents/model-selector.js.map +1 -0
- package/dist/agents/onboarding.d.ts +65 -0
- package/dist/agents/onboarding.d.ts.map +1 -0
- package/dist/agents/onboarding.js +373 -0
- package/dist/agents/onboarding.js.map +1 -0
- package/dist/build/bundle.d.ts +32 -0
- package/dist/build/bundle.d.ts.map +1 -0
- package/dist/build/bundle.js +97 -0
- package/dist/build/bundle.js.map +1 -0
- package/dist/build/ci-pipeline.d.ts +51 -0
- package/dist/build/ci-pipeline.d.ts.map +1 -0
- package/dist/build/ci-pipeline.js +180 -0
- package/dist/build/ci-pipeline.js.map +1 -0
- package/dist/build/github-dist.d.ts +37 -0
- package/dist/build/github-dist.d.ts.map +1 -0
- package/dist/build/github-dist.js +117 -0
- package/dist/build/github-dist.js.map +1 -0
- package/dist/build/index.d.ts +11 -0
- package/dist/build/index.d.ts.map +1 -0
- package/dist/build/index.js +11 -0
- package/dist/build/index.js.map +1 -0
- package/dist/build/install-migration.d.ts +28 -0
- package/dist/build/install-migration.d.ts.map +1 -0
- package/dist/build/install-migration.js +103 -0
- package/dist/build/install-migration.js.map +1 -0
- package/dist/build/npm-package.d.ts +54 -0
- package/dist/build/npm-package.d.ts.map +1 -0
- package/dist/build/npm-package.js +128 -0
- package/dist/build/npm-package.js.map +1 -0
- package/dist/build/release.d.ts +108 -0
- package/dist/build/release.d.ts.map +1 -0
- package/dist/build/release.js +295 -0
- package/dist/build/release.js.map +1 -0
- package/dist/build/versioning.d.ts +38 -0
- package/dist/build/versioning.d.ts.map +1 -0
- package/dist/build/versioning.js +113 -0
- package/dist/build/versioning.js.map +1 -0
- package/dist/casting/casting-engine.d.ts +60 -0
- package/dist/casting/casting-engine.d.ts.map +1 -0
- package/dist/casting/casting-engine.js +223 -0
- package/dist/casting/casting-engine.js.map +1 -0
- package/dist/casting/casting-history.d.ts +54 -0
- package/dist/casting/casting-history.d.ts.map +1 -0
- package/dist/casting/casting-history.js +63 -0
- package/dist/casting/casting-history.js.map +1 -0
- package/dist/casting/index.d.ts +46 -0
- package/dist/casting/index.d.ts.map +1 -0
- package/dist/casting/index.js +37 -0
- package/dist/casting/index.js.map +1 -0
- package/dist/client/event-bus.d.ts +29 -0
- package/dist/client/event-bus.d.ts.map +1 -0
- package/dist/client/event-bus.js +53 -0
- package/dist/client/event-bus.js.map +1 -0
- package/dist/client/index.d.ts +100 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.js +170 -0
- package/dist/client/index.js.map +1 -0
- package/dist/client/session-pool.d.ts +66 -0
- package/dist/client/session-pool.d.ts.map +1 -0
- package/dist/client/session-pool.js +145 -0
- package/dist/client/session-pool.js.map +1 -0
- package/dist/config/agent-doc.d.ts +43 -0
- package/dist/config/agent-doc.d.ts.map +1 -0
- package/dist/config/agent-doc.js +158 -0
- package/dist/config/agent-doc.js.map +1 -0
- package/dist/config/agent-source.d.ts +95 -0
- package/dist/config/agent-source.d.ts.map +1 -0
- package/dist/config/agent-source.js +274 -0
- package/dist/config/agent-source.js.map +1 -0
- package/dist/config/doc-sync.d.ts +66 -0
- package/dist/config/doc-sync.d.ts.map +1 -0
- package/dist/config/doc-sync.js +270 -0
- package/dist/config/doc-sync.js.map +1 -0
- package/dist/config/feature-audit.d.ts +49 -0
- package/dist/config/feature-audit.d.ts.map +1 -0
- package/dist/config/feature-audit.js +148 -0
- package/dist/config/feature-audit.js.map +1 -0
- package/dist/config/index.d.ts +15 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +15 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/init.d.ts +61 -0
- package/dist/config/init.d.ts.map +1 -0
- package/dist/config/init.js +369 -0
- package/dist/config/init.js.map +1 -0
- package/dist/config/legacy-fallback.d.ts +83 -0
- package/dist/config/legacy-fallback.d.ts.map +1 -0
- package/dist/config/legacy-fallback.js +212 -0
- package/dist/config/legacy-fallback.js.map +1 -0
- package/dist/config/markdown-migration.d.ts +157 -0
- package/dist/config/markdown-migration.d.ts.map +1 -0
- package/dist/config/markdown-migration.js +434 -0
- package/dist/config/markdown-migration.js.map +1 -0
- package/dist/config/migration.d.ts +123 -0
- package/dist/config/migration.d.ts.map +1 -0
- package/dist/config/migration.js +273 -0
- package/dist/config/migration.js.map +1 -0
- package/dist/config/migrations/index.d.ts +36 -0
- package/dist/config/migrations/index.d.ts.map +1 -0
- package/dist/config/migrations/index.js +216 -0
- package/dist/config/migrations/index.js.map +1 -0
- package/dist/config/models.d.ts +134 -0
- package/dist/config/models.d.ts.map +1 -0
- package/dist/config/models.js +354 -0
- package/dist/config/models.js.map +1 -0
- package/dist/config/routing.d.ts +118 -0
- package/dist/config/routing.d.ts.map +1 -0
- package/dist/config/routing.js +247 -0
- package/dist/config/routing.js.map +1 -0
- package/dist/config/schema.d.ts +72 -0
- package/dist/config/schema.d.ts.map +1 -0
- package/dist/config/schema.js +63 -0
- package/dist/config/schema.js.map +1 -0
- package/dist/coordinator/coordinator.d.ts +82 -0
- package/dist/coordinator/coordinator.d.ts.map +1 -0
- package/dist/coordinator/coordinator.js +174 -0
- package/dist/coordinator/coordinator.js.map +1 -0
- package/dist/coordinator/direct-response.d.ts +83 -0
- package/dist/coordinator/direct-response.d.ts.map +1 -0
- package/dist/coordinator/direct-response.js +187 -0
- package/dist/coordinator/direct-response.js.map +1 -0
- package/dist/coordinator/fan-out.d.ts +83 -0
- package/dist/coordinator/fan-out.d.ts.map +1 -0
- package/dist/coordinator/fan-out.js +161 -0
- package/dist/coordinator/fan-out.js.map +1 -0
- package/dist/coordinator/index.d.ts +47 -0
- package/dist/coordinator/index.d.ts.map +1 -0
- package/dist/coordinator/index.js +54 -0
- package/dist/coordinator/index.js.map +1 -0
- package/dist/coordinator/response-tiers.d.ts +49 -0
- package/dist/coordinator/response-tiers.d.ts.map +1 -0
- package/dist/coordinator/response-tiers.js +149 -0
- package/dist/coordinator/response-tiers.js.map +1 -0
- package/dist/hooks/index.d.ts +103 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.js +279 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/index.d.ts +24 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +23 -3
- package/dist/index.js.map +1 -1
- package/dist/marketplace/backend.d.ts +35 -0
- package/dist/marketplace/backend.d.ts.map +1 -0
- package/dist/marketplace/backend.js +99 -0
- package/dist/marketplace/backend.js.map +1 -0
- package/dist/marketplace/browser.d.ts +33 -0
- package/dist/marketplace/browser.d.ts.map +1 -0
- package/dist/marketplace/browser.js +97 -0
- package/dist/marketplace/browser.js.map +1 -0
- package/dist/marketplace/extension-adapter.d.ts +51 -0
- package/dist/marketplace/extension-adapter.d.ts.map +1 -0
- package/dist/marketplace/extension-adapter.js +81 -0
- package/dist/marketplace/extension-adapter.js.map +1 -0
- package/dist/marketplace/index.d.ts +51 -0
- package/dist/marketplace/index.d.ts.map +1 -0
- package/dist/marketplace/index.js +108 -0
- package/dist/marketplace/index.js.map +1 -0
- package/dist/marketplace/packaging.d.ts +25 -0
- package/dist/marketplace/packaging.d.ts.map +1 -0
- package/dist/marketplace/packaging.js +117 -0
- package/dist/marketplace/packaging.js.map +1 -0
- package/dist/marketplace/schema.d.ts +50 -0
- package/dist/marketplace/schema.d.ts.map +1 -0
- package/dist/marketplace/schema.js +120 -0
- package/dist/marketplace/schema.js.map +1 -0
- package/dist/marketplace/security.d.ts +26 -0
- package/dist/marketplace/security.d.ts.map +1 -0
- package/dist/marketplace/security.js +199 -0
- package/dist/marketplace/security.js.map +1 -0
- package/dist/parsers.d.ts +15 -0
- package/dist/parsers.d.ts.map +1 -0
- package/dist/parsers.js +15 -0
- package/dist/parsers.js.map +1 -0
- package/dist/ralph/index.d.ts +56 -0
- package/dist/ralph/index.d.ts.map +1 -0
- package/dist/ralph/index.js +61 -0
- package/dist/ralph/index.js.map +1 -0
- package/dist/resolution.d.ts +47 -0
- package/dist/resolution.d.ts.map +1 -0
- package/dist/resolution.js +106 -0
- package/dist/resolution.js.map +1 -0
- package/dist/runtime/benchmarks.d.ts +121 -0
- package/dist/runtime/benchmarks.d.ts.map +1 -0
- package/dist/runtime/benchmarks.js +251 -0
- package/dist/runtime/benchmarks.js.map +1 -0
- package/dist/runtime/config.d.ts +313 -0
- package/dist/runtime/config.d.ts.map +1 -0
- package/dist/runtime/config.js +466 -0
- package/dist/runtime/config.js.map +1 -0
- package/dist/runtime/cost-tracker.d.ts +73 -0
- package/dist/runtime/cost-tracker.d.ts.map +1 -0
- package/dist/runtime/cost-tracker.js +157 -0
- package/dist/runtime/cost-tracker.js.map +1 -0
- package/dist/runtime/event-bus.d.ts +190 -0
- package/dist/runtime/event-bus.d.ts.map +1 -0
- package/dist/runtime/event-bus.js +218 -0
- package/dist/runtime/event-bus.js.map +1 -0
- package/dist/runtime/health.d.ts +66 -0
- package/dist/runtime/health.d.ts.map +1 -0
- package/dist/runtime/health.js +111 -0
- package/dist/runtime/health.js.map +1 -0
- package/dist/runtime/i18n.d.ts +54 -0
- package/dist/runtime/i18n.d.ts.map +1 -0
- package/dist/runtime/i18n.js +126 -0
- package/dist/runtime/i18n.js.map +1 -0
- package/dist/runtime/offline.d.ts +64 -0
- package/dist/runtime/offline.d.ts.map +1 -0
- package/dist/runtime/offline.js +108 -0
- package/dist/runtime/offline.js.map +1 -0
- package/dist/runtime/streaming.d.ts +97 -0
- package/dist/runtime/streaming.d.ts.map +1 -0
- package/dist/runtime/streaming.js +156 -0
- package/dist/runtime/streaming.js.map +1 -0
- package/dist/runtime/telemetry.d.ts +82 -0
- package/dist/runtime/telemetry.d.ts.map +1 -0
- package/dist/runtime/telemetry.js +120 -0
- package/dist/runtime/telemetry.js.map +1 -0
- package/dist/sharing/agent-repo.d.ts +33 -0
- package/dist/sharing/agent-repo.d.ts.map +1 -0
- package/dist/sharing/agent-repo.js +79 -0
- package/dist/sharing/agent-repo.js.map +1 -0
- package/dist/sharing/cache.d.ts +36 -0
- package/dist/sharing/cache.d.ts.map +1 -0
- package/dist/sharing/cache.js +85 -0
- package/dist/sharing/cache.js.map +1 -0
- package/dist/sharing/conflicts.d.ts +32 -0
- package/dist/sharing/conflicts.d.ts.map +1 -0
- package/dist/sharing/conflicts.js +121 -0
- package/dist/sharing/conflicts.js.map +1 -0
- package/dist/sharing/export.d.ts +50 -0
- package/dist/sharing/export.d.ts.map +1 -0
- package/dist/sharing/export.js +156 -0
- package/dist/sharing/export.js.map +1 -0
- package/dist/sharing/history-split.d.ts +34 -0
- package/dist/sharing/history-split.d.ts.map +1 -0
- package/dist/sharing/history-split.js +101 -0
- package/dist/sharing/history-split.js.map +1 -0
- package/dist/sharing/import.d.ts +37 -0
- package/dist/sharing/import.d.ts.map +1 -0
- package/dist/sharing/import.js +138 -0
- package/dist/sharing/import.js.map +1 -0
- package/dist/sharing/index.d.ts +11 -0
- package/dist/sharing/index.d.ts.map +1 -0
- package/dist/sharing/index.js +11 -0
- package/dist/sharing/index.js.map +1 -0
- package/dist/sharing/versioning.d.ts +32 -0
- package/dist/sharing/versioning.d.ts.map +1 -0
- package/dist/sharing/versioning.js +64 -0
- package/dist/sharing/versioning.js.map +1 -0
- package/dist/skills/index.d.ts +49 -0
- package/dist/skills/index.d.ts.map +1 -0
- package/dist/skills/index.js +85 -0
- package/dist/skills/index.js.map +1 -0
- package/dist/skills/skill-loader.d.ts +56 -0
- package/dist/skills/skill-loader.d.ts.map +1 -0
- package/dist/skills/skill-loader.js +106 -0
- package/dist/skills/skill-loader.js.map +1 -0
- package/dist/skills/skill-source.d.ts +63 -0
- package/dist/skills/skill-source.d.ts.map +1 -0
- package/dist/skills/skill-source.js +199 -0
- package/dist/skills/skill-source.js.map +1 -0
- package/dist/tools/index.d.ts +87 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +419 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/types.d.ts +43 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +8 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/normalize-eol.d.ts +6 -0
- package/dist/utils/normalize-eol.d.ts.map +1 -0
- package/dist/utils/normalize-eol.js +8 -0
- package/dist/utils/normalize-eol.js.map +1 -0
- package/package.json +115 -63
|
@@ -0,0 +1,779 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Squad SDK Adapter Types
|
|
3
|
+
*
|
|
4
|
+
* This module provides Squad-stable interfaces that decouple Squad from
|
|
5
|
+
* direct dependencies on @github/copilot-sdk types. All Squad code should
|
|
6
|
+
* import types from this adapter layer, never directly from the Copilot SDK.
|
|
7
|
+
*
|
|
8
|
+
* @module adapter/types
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Configuration for creating a Squad session.
|
|
12
|
+
* Wraps and stabilizes the Copilot SDK SessionConfig type.
|
|
13
|
+
*/
|
|
14
|
+
export interface SquadSessionConfig {
|
|
15
|
+
/**
|
|
16
|
+
* Optional custom session ID.
|
|
17
|
+
* If not provided, one will be generated.
|
|
18
|
+
*/
|
|
19
|
+
sessionId?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Client name to identify the application using Squad.
|
|
22
|
+
* Included in User-Agent headers for API requests.
|
|
23
|
+
*/
|
|
24
|
+
clientName?: string;
|
|
25
|
+
/**
|
|
26
|
+
* Model identifier to use for this session.
|
|
27
|
+
* @example "claude-sonnet-4.5"
|
|
28
|
+
*/
|
|
29
|
+
model?: string;
|
|
30
|
+
/**
|
|
31
|
+
* Reasoning effort level for models that support it.
|
|
32
|
+
* Only valid for models where capabilities support reasoning effort.
|
|
33
|
+
* @example "medium"
|
|
34
|
+
*/
|
|
35
|
+
reasoningEffort?: SquadReasoningEffort;
|
|
36
|
+
/**
|
|
37
|
+
* Override the default configuration directory location.
|
|
38
|
+
* When specified, the session will use this directory for config and state.
|
|
39
|
+
*/
|
|
40
|
+
configDir?: string;
|
|
41
|
+
/**
|
|
42
|
+
* Tools exposed to the agent session.
|
|
43
|
+
* Each tool defines a capability the agent can invoke.
|
|
44
|
+
*/
|
|
45
|
+
tools?: SquadTool<any>[];
|
|
46
|
+
/**
|
|
47
|
+
* System message configuration.
|
|
48
|
+
* Controls how the system prompt is constructed.
|
|
49
|
+
*/
|
|
50
|
+
systemMessage?: SquadSystemMessageConfig;
|
|
51
|
+
/**
|
|
52
|
+
* List of tool names to allow. When specified, only these tools are available.
|
|
53
|
+
* Takes precedence over excludedTools.
|
|
54
|
+
*/
|
|
55
|
+
availableTools?: string[];
|
|
56
|
+
/**
|
|
57
|
+
* List of tool names to disable. All other tools remain available.
|
|
58
|
+
* Ignored if availableTools is specified.
|
|
59
|
+
*/
|
|
60
|
+
excludedTools?: string[];
|
|
61
|
+
/**
|
|
62
|
+
* Custom provider configuration (BYOK - Bring Your Own Key).
|
|
63
|
+
* When specified, uses the provided API endpoint instead of Copilot API.
|
|
64
|
+
*/
|
|
65
|
+
provider?: SquadProviderConfig;
|
|
66
|
+
/**
|
|
67
|
+
* Handler for permission requests from the agent.
|
|
68
|
+
* Called when the agent needs permission for operations.
|
|
69
|
+
*/
|
|
70
|
+
onPermissionRequest?: SquadPermissionHandler;
|
|
71
|
+
/**
|
|
72
|
+
* Handler for user input requests from the agent.
|
|
73
|
+
* When provided, enables the ask_user tool.
|
|
74
|
+
*/
|
|
75
|
+
onUserInputRequest?: SquadUserInputHandler;
|
|
76
|
+
/**
|
|
77
|
+
* Hook handlers for intercepting session lifecycle events.
|
|
78
|
+
* Enables custom logic at various points in the session lifecycle.
|
|
79
|
+
*/
|
|
80
|
+
hooks?: SquadSessionHooks;
|
|
81
|
+
/**
|
|
82
|
+
* Working directory for the session.
|
|
83
|
+
* Tool operations will be relative to this directory.
|
|
84
|
+
*/
|
|
85
|
+
workingDirectory?: string;
|
|
86
|
+
/**
|
|
87
|
+
* Enable streaming of assistant message and reasoning chunks.
|
|
88
|
+
* When true, delta events are sent as the response is generated.
|
|
89
|
+
* @default false
|
|
90
|
+
*/
|
|
91
|
+
streaming?: boolean;
|
|
92
|
+
/**
|
|
93
|
+
* MCP server configurations for the session.
|
|
94
|
+
* Keys are server names, values are server configurations.
|
|
95
|
+
*/
|
|
96
|
+
mcpServers?: Record<string, SquadMCPServerConfig>;
|
|
97
|
+
/**
|
|
98
|
+
* Custom agent configurations for the session.
|
|
99
|
+
*/
|
|
100
|
+
customAgents?: SquadCustomAgentConfig[];
|
|
101
|
+
/**
|
|
102
|
+
* Directories to load skills from.
|
|
103
|
+
*/
|
|
104
|
+
skillDirectories?: string[];
|
|
105
|
+
/**
|
|
106
|
+
* List of skill names to disable.
|
|
107
|
+
*/
|
|
108
|
+
disabledSkills?: string[];
|
|
109
|
+
/**
|
|
110
|
+
* Infinite session configuration for persistent workspaces.
|
|
111
|
+
* When enabled (default), sessions automatically manage context limits.
|
|
112
|
+
*/
|
|
113
|
+
infiniteSessions?: SquadInfiniteSessionConfig;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Configuration for session lifecycle hooks.
|
|
117
|
+
* Hooks allow Squad to intercept and respond to key events.
|
|
118
|
+
*/
|
|
119
|
+
export interface SquadSessionHooks {
|
|
120
|
+
/**
|
|
121
|
+
* Called before a tool is executed.
|
|
122
|
+
* Can modify arguments, add context, or block execution.
|
|
123
|
+
*/
|
|
124
|
+
onPreToolUse?: SquadPreToolUseHandler;
|
|
125
|
+
/**
|
|
126
|
+
* Called after a tool is executed.
|
|
127
|
+
* Can modify results or add context.
|
|
128
|
+
*/
|
|
129
|
+
onPostToolUse?: SquadPostToolUseHandler;
|
|
130
|
+
/**
|
|
131
|
+
* Called when the user submits a prompt.
|
|
132
|
+
* Can modify the prompt or inject context.
|
|
133
|
+
*/
|
|
134
|
+
onUserPromptSubmitted?: SquadUserPromptSubmittedHandler;
|
|
135
|
+
/**
|
|
136
|
+
* Called when a session starts.
|
|
137
|
+
* Can inject initial context or modify configuration.
|
|
138
|
+
*/
|
|
139
|
+
onSessionStart?: SquadSessionStartHandler;
|
|
140
|
+
/**
|
|
141
|
+
* Called when a session ends.
|
|
142
|
+
* Can perform cleanup or capture session summary.
|
|
143
|
+
*/
|
|
144
|
+
onSessionEnd?: SquadSessionEndHandler;
|
|
145
|
+
/**
|
|
146
|
+
* Called when an error occurs.
|
|
147
|
+
* Can implement retry logic or custom error handling.
|
|
148
|
+
*/
|
|
149
|
+
onErrorOccurred?: SquadErrorOccurredHandler;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Base interface for all hook inputs.
|
|
153
|
+
* Provides common context available to all hooks.
|
|
154
|
+
*/
|
|
155
|
+
export interface SquadBaseHookInput {
|
|
156
|
+
/** Timestamp when the hook was triggered (milliseconds since epoch) */
|
|
157
|
+
timestamp: number;
|
|
158
|
+
/** Current working directory */
|
|
159
|
+
cwd: string;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Input for pre-tool-use hook.
|
|
163
|
+
*/
|
|
164
|
+
export interface SquadPreToolUseHookInput extends SquadBaseHookInput {
|
|
165
|
+
/** Name of the tool about to be executed */
|
|
166
|
+
toolName: string;
|
|
167
|
+
/** Arguments passed to the tool */
|
|
168
|
+
toolArgs: unknown;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Output for pre-tool-use hook.
|
|
172
|
+
* All fields are optional; return undefined/void to proceed normally.
|
|
173
|
+
*/
|
|
174
|
+
export interface SquadPreToolUseHookOutput {
|
|
175
|
+
/** Permission decision for this tool use */
|
|
176
|
+
permissionDecision?: "allow" | "deny" | "ask";
|
|
177
|
+
/** Reason for the permission decision */
|
|
178
|
+
permissionDecisionReason?: string;
|
|
179
|
+
/** Modified arguments to pass to the tool */
|
|
180
|
+
modifiedArgs?: unknown;
|
|
181
|
+
/** Additional context to inject before tool execution */
|
|
182
|
+
additionalContext?: string;
|
|
183
|
+
/** Whether to suppress output from this tool */
|
|
184
|
+
suppressOutput?: boolean;
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Handler for pre-tool-use hook.
|
|
188
|
+
*/
|
|
189
|
+
export type SquadPreToolUseHandler = (input: SquadPreToolUseHookInput, invocation: {
|
|
190
|
+
sessionId: string;
|
|
191
|
+
}) => Promise<SquadPreToolUseHookOutput | void> | SquadPreToolUseHookOutput | void;
|
|
192
|
+
/**
|
|
193
|
+
* Input for post-tool-use hook.
|
|
194
|
+
*/
|
|
195
|
+
export interface SquadPostToolUseHookInput extends SquadBaseHookInput {
|
|
196
|
+
/** Name of the tool that was executed */
|
|
197
|
+
toolName: string;
|
|
198
|
+
/** Arguments that were passed to the tool */
|
|
199
|
+
toolArgs: unknown;
|
|
200
|
+
/** Result returned from the tool */
|
|
201
|
+
toolResult: SquadToolResultObject;
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Output for post-tool-use hook.
|
|
205
|
+
*/
|
|
206
|
+
export interface SquadPostToolUseHookOutput {
|
|
207
|
+
/** Modified result to return instead of the original */
|
|
208
|
+
modifiedResult?: SquadToolResultObject;
|
|
209
|
+
/** Additional context to inject after tool execution */
|
|
210
|
+
additionalContext?: string;
|
|
211
|
+
/** Whether to suppress output from this tool */
|
|
212
|
+
suppressOutput?: boolean;
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Handler for post-tool-use hook.
|
|
216
|
+
*/
|
|
217
|
+
export type SquadPostToolUseHandler = (input: SquadPostToolUseHookInput, invocation: {
|
|
218
|
+
sessionId: string;
|
|
219
|
+
}) => Promise<SquadPostToolUseHookOutput | void> | SquadPostToolUseHookOutput | void;
|
|
220
|
+
/**
|
|
221
|
+
* Input for user-prompt-submitted hook.
|
|
222
|
+
*/
|
|
223
|
+
export interface SquadUserPromptSubmittedHookInput extends SquadBaseHookInput {
|
|
224
|
+
/** The prompt submitted by the user */
|
|
225
|
+
prompt: string;
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Output for user-prompt-submitted hook.
|
|
229
|
+
*/
|
|
230
|
+
export interface SquadUserPromptSubmittedHookOutput {
|
|
231
|
+
/** Modified prompt to use instead of the original */
|
|
232
|
+
modifiedPrompt?: string;
|
|
233
|
+
/** Additional context to inject with the prompt */
|
|
234
|
+
additionalContext?: string;
|
|
235
|
+
/** Whether to suppress output */
|
|
236
|
+
suppressOutput?: boolean;
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Handler for user-prompt-submitted hook.
|
|
240
|
+
*/
|
|
241
|
+
export type SquadUserPromptSubmittedHandler = (input: SquadUserPromptSubmittedHookInput, invocation: {
|
|
242
|
+
sessionId: string;
|
|
243
|
+
}) => Promise<SquadUserPromptSubmittedHookOutput | void> | SquadUserPromptSubmittedHookOutput | void;
|
|
244
|
+
/**
|
|
245
|
+
* Input for session-start hook.
|
|
246
|
+
*/
|
|
247
|
+
export interface SquadSessionStartHookInput extends SquadBaseHookInput {
|
|
248
|
+
/** How the session was started */
|
|
249
|
+
source: "startup" | "resume" | "new";
|
|
250
|
+
/** Initial prompt if provided */
|
|
251
|
+
initialPrompt?: string;
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* Output for session-start hook.
|
|
255
|
+
*/
|
|
256
|
+
export interface SquadSessionStartHookOutput {
|
|
257
|
+
/** Additional context to inject at session start */
|
|
258
|
+
additionalContext?: string;
|
|
259
|
+
/** Modified configuration to apply */
|
|
260
|
+
modifiedConfig?: Record<string, unknown>;
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* Handler for session-start hook.
|
|
264
|
+
*/
|
|
265
|
+
export type SquadSessionStartHandler = (input: SquadSessionStartHookInput, invocation: {
|
|
266
|
+
sessionId: string;
|
|
267
|
+
}) => Promise<SquadSessionStartHookOutput | void> | SquadSessionStartHookOutput | void;
|
|
268
|
+
/**
|
|
269
|
+
* Input for session-end hook.
|
|
270
|
+
*/
|
|
271
|
+
export interface SquadSessionEndHookInput extends SquadBaseHookInput {
|
|
272
|
+
/** Reason the session ended */
|
|
273
|
+
reason: "complete" | "error" | "abort" | "timeout" | "user_exit";
|
|
274
|
+
/** Final message if available */
|
|
275
|
+
finalMessage?: string;
|
|
276
|
+
/** Error message if the session ended due to an error */
|
|
277
|
+
error?: string;
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* Output for session-end hook.
|
|
281
|
+
*/
|
|
282
|
+
export interface SquadSessionEndHookOutput {
|
|
283
|
+
/** Whether to suppress output */
|
|
284
|
+
suppressOutput?: boolean;
|
|
285
|
+
/** Cleanup actions performed */
|
|
286
|
+
cleanupActions?: string[];
|
|
287
|
+
/** Summary of the session */
|
|
288
|
+
sessionSummary?: string;
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* Handler for session-end hook.
|
|
292
|
+
*/
|
|
293
|
+
export type SquadSessionEndHandler = (input: SquadSessionEndHookInput, invocation: {
|
|
294
|
+
sessionId: string;
|
|
295
|
+
}) => Promise<SquadSessionEndHookOutput | void> | SquadSessionEndHookOutput | void;
|
|
296
|
+
/**
|
|
297
|
+
* Input for error-occurred hook.
|
|
298
|
+
*/
|
|
299
|
+
export interface SquadErrorOccurredHookInput extends SquadBaseHookInput {
|
|
300
|
+
/** Error message */
|
|
301
|
+
error: string;
|
|
302
|
+
/** Context where the error occurred */
|
|
303
|
+
errorContext: "model_call" | "tool_execution" | "system" | "user_input";
|
|
304
|
+
/** Whether the error is recoverable */
|
|
305
|
+
recoverable: boolean;
|
|
306
|
+
}
|
|
307
|
+
/**
|
|
308
|
+
* Output for error-occurred hook.
|
|
309
|
+
*/
|
|
310
|
+
export interface SquadErrorOccurredHookOutput {
|
|
311
|
+
/** Whether to suppress output */
|
|
312
|
+
suppressOutput?: boolean;
|
|
313
|
+
/** How to handle the error */
|
|
314
|
+
errorHandling?: "retry" | "skip" | "abort";
|
|
315
|
+
/** Number of retries to attempt */
|
|
316
|
+
retryCount?: number;
|
|
317
|
+
/** Notification to show the user */
|
|
318
|
+
userNotification?: string;
|
|
319
|
+
}
|
|
320
|
+
/**
|
|
321
|
+
* Handler for error-occurred hook.
|
|
322
|
+
*/
|
|
323
|
+
export type SquadErrorOccurredHandler = (input: SquadErrorOccurredHookInput, invocation: {
|
|
324
|
+
sessionId: string;
|
|
325
|
+
}) => Promise<SquadErrorOccurredHookOutput | void> | SquadErrorOccurredHookOutput | void;
|
|
326
|
+
/**
|
|
327
|
+
* Base interface for MCP server configuration.
|
|
328
|
+
*/
|
|
329
|
+
interface SquadMCPServerConfigBase {
|
|
330
|
+
/**
|
|
331
|
+
* List of tools to include from this server.
|
|
332
|
+
* [] means none, "*" means all.
|
|
333
|
+
*/
|
|
334
|
+
tools: string[];
|
|
335
|
+
/**
|
|
336
|
+
* Server type: "local", "stdio", "http", or "sse".
|
|
337
|
+
* Defaults to "local" if not specified.
|
|
338
|
+
*/
|
|
339
|
+
type?: string;
|
|
340
|
+
/**
|
|
341
|
+
* Optional timeout in milliseconds for tool calls to this server.
|
|
342
|
+
*/
|
|
343
|
+
timeout?: number;
|
|
344
|
+
}
|
|
345
|
+
/**
|
|
346
|
+
* Configuration for a local/stdio MCP server.
|
|
347
|
+
*/
|
|
348
|
+
export interface SquadMCPLocalServerConfig extends SquadMCPServerConfigBase {
|
|
349
|
+
type?: "local" | "stdio";
|
|
350
|
+
/** Command to execute */
|
|
351
|
+
command: string;
|
|
352
|
+
/** Command-line arguments */
|
|
353
|
+
args: string[];
|
|
354
|
+
/** Environment variables to pass to the server */
|
|
355
|
+
env?: Record<string, string>;
|
|
356
|
+
/** Working directory for the server process */
|
|
357
|
+
cwd?: string;
|
|
358
|
+
}
|
|
359
|
+
/**
|
|
360
|
+
* Configuration for a remote MCP server (HTTP or SSE).
|
|
361
|
+
*/
|
|
362
|
+
export interface SquadMCPRemoteServerConfig extends SquadMCPServerConfigBase {
|
|
363
|
+
type: "http" | "sse";
|
|
364
|
+
/** URL of the remote server */
|
|
365
|
+
url: string;
|
|
366
|
+
/** Optional HTTP headers to include in requests */
|
|
367
|
+
headers?: Record<string, string>;
|
|
368
|
+
}
|
|
369
|
+
/**
|
|
370
|
+
* Union type for MCP server configurations.
|
|
371
|
+
* Squad supports both local and remote MCP servers.
|
|
372
|
+
*/
|
|
373
|
+
export type SquadMCPServerConfig = SquadMCPLocalServerConfig | SquadMCPRemoteServerConfig;
|
|
374
|
+
/**
|
|
375
|
+
* Result type for tool execution.
|
|
376
|
+
*/
|
|
377
|
+
export type SquadToolResultType = "success" | "failure" | "rejected" | "denied";
|
|
378
|
+
/**
|
|
379
|
+
* Binary result (e.g., images, files) returned from a tool.
|
|
380
|
+
*/
|
|
381
|
+
export interface SquadToolBinaryResult {
|
|
382
|
+
/** Base64-encoded binary data */
|
|
383
|
+
data: string;
|
|
384
|
+
/** MIME type of the data */
|
|
385
|
+
mimeType: string;
|
|
386
|
+
/** Type identifier */
|
|
387
|
+
type: string;
|
|
388
|
+
/** Optional description */
|
|
389
|
+
description?: string;
|
|
390
|
+
}
|
|
391
|
+
/**
|
|
392
|
+
* Structured tool result object.
|
|
393
|
+
*/
|
|
394
|
+
export interface SquadToolResultObject {
|
|
395
|
+
/** Text result for the LLM to process */
|
|
396
|
+
textResultForLlm: string;
|
|
397
|
+
/** Optional binary results (images, files, etc.) */
|
|
398
|
+
binaryResultsForLlm?: SquadToolBinaryResult[];
|
|
399
|
+
/** Result type indicator */
|
|
400
|
+
resultType: SquadToolResultType;
|
|
401
|
+
/** Error message if the tool failed */
|
|
402
|
+
error?: string;
|
|
403
|
+
/** Session log output */
|
|
404
|
+
sessionLog?: string;
|
|
405
|
+
/** Tool-specific telemetry data */
|
|
406
|
+
toolTelemetry?: Record<string, unknown>;
|
|
407
|
+
}
|
|
408
|
+
/**
|
|
409
|
+
* Tool result can be a simple string or a structured object.
|
|
410
|
+
*/
|
|
411
|
+
export type SquadToolResult = string | SquadToolResultObject;
|
|
412
|
+
/**
|
|
413
|
+
* Context provided to tool handlers when invoked.
|
|
414
|
+
*/
|
|
415
|
+
export interface SquadToolInvocation {
|
|
416
|
+
/** Session ID where the tool was invoked */
|
|
417
|
+
sessionId: string;
|
|
418
|
+
/** Unique ID for this tool call */
|
|
419
|
+
toolCallId: string;
|
|
420
|
+
/** Name of the tool being invoked */
|
|
421
|
+
toolName: string;
|
|
422
|
+
/** Arguments passed to the tool (untyped) */
|
|
423
|
+
arguments: unknown;
|
|
424
|
+
}
|
|
425
|
+
/**
|
|
426
|
+
* Handler function for tool execution.
|
|
427
|
+
* @template TArgs - Type of the tool arguments
|
|
428
|
+
*/
|
|
429
|
+
export type SquadToolHandler<TArgs = unknown> = (args: TArgs, invocation: SquadToolInvocation) => Promise<unknown> | unknown;
|
|
430
|
+
/**
|
|
431
|
+
* Zod-like schema interface for type inference.
|
|
432
|
+
* Any object with a toJSONSchema() method is treated as a schema.
|
|
433
|
+
*/
|
|
434
|
+
export interface SquadZodSchema<T = unknown> {
|
|
435
|
+
_output: T;
|
|
436
|
+
toJSONSchema(): Record<string, unknown>;
|
|
437
|
+
}
|
|
438
|
+
/**
|
|
439
|
+
* Tool definition for Squad.
|
|
440
|
+
* Tools are capabilities that agents can invoke during execution.
|
|
441
|
+
*
|
|
442
|
+
* @template TArgs - Type of the tool arguments (inferred from schema)
|
|
443
|
+
*/
|
|
444
|
+
export interface SquadTool<TArgs = unknown> {
|
|
445
|
+
/** Unique name for the tool */
|
|
446
|
+
name: string;
|
|
447
|
+
/** Human-readable description of what the tool does */
|
|
448
|
+
description?: string;
|
|
449
|
+
/** Parameter schema (Zod schema or JSON schema object) */
|
|
450
|
+
parameters?: SquadZodSchema<TArgs> | Record<string, unknown>;
|
|
451
|
+
/** Handler function that implements the tool */
|
|
452
|
+
handler: SquadToolHandler<TArgs>;
|
|
453
|
+
}
|
|
454
|
+
/**
|
|
455
|
+
* Append mode: Use CLI foundation with optional appended content (default).
|
|
456
|
+
*/
|
|
457
|
+
export interface SquadSystemMessageAppendConfig {
|
|
458
|
+
mode?: "append";
|
|
459
|
+
/**
|
|
460
|
+
* Additional instructions appended after SDK-managed sections.
|
|
461
|
+
*/
|
|
462
|
+
content?: string;
|
|
463
|
+
}
|
|
464
|
+
/**
|
|
465
|
+
* Replace mode: Use caller-provided system message entirely.
|
|
466
|
+
* Removes all SDK guardrails including security restrictions.
|
|
467
|
+
*/
|
|
468
|
+
export interface SquadSystemMessageReplaceConfig {
|
|
469
|
+
mode: "replace";
|
|
470
|
+
/**
|
|
471
|
+
* Complete system message content.
|
|
472
|
+
* Replaces the entire SDK-managed system message.
|
|
473
|
+
*/
|
|
474
|
+
content: string;
|
|
475
|
+
}
|
|
476
|
+
/**
|
|
477
|
+
* System message configuration for session creation.
|
|
478
|
+
* Controls how the agent's system prompt is constructed.
|
|
479
|
+
*/
|
|
480
|
+
export type SquadSystemMessageConfig = SquadSystemMessageAppendConfig | SquadSystemMessageReplaceConfig;
|
|
481
|
+
/**
|
|
482
|
+
* Permission request from the agent.
|
|
483
|
+
*/
|
|
484
|
+
export interface SquadPermissionRequest {
|
|
485
|
+
/** Type of permission being requested */
|
|
486
|
+
kind: "shell" | "write" | "mcp" | "read" | "url";
|
|
487
|
+
/** Tool call ID if associated with a specific tool call */
|
|
488
|
+
toolCallId?: string;
|
|
489
|
+
/** Additional request-specific data */
|
|
490
|
+
[key: string]: unknown;
|
|
491
|
+
}
|
|
492
|
+
/**
|
|
493
|
+
* Result of a permission request.
|
|
494
|
+
*/
|
|
495
|
+
export interface SquadPermissionRequestResult {
|
|
496
|
+
/** Outcome of the permission request */
|
|
497
|
+
kind: "approved" | "denied-by-rules" | "denied-no-approval-rule-and-could-not-request-from-user" | "denied-interactively-by-user";
|
|
498
|
+
/** Rules that influenced the decision */
|
|
499
|
+
rules?: unknown[];
|
|
500
|
+
}
|
|
501
|
+
/**
|
|
502
|
+
* Handler for permission requests from the agent.
|
|
503
|
+
*/
|
|
504
|
+
export type SquadPermissionHandler = (request: SquadPermissionRequest, invocation: {
|
|
505
|
+
sessionId: string;
|
|
506
|
+
}) => Promise<SquadPermissionRequestResult> | SquadPermissionRequestResult;
|
|
507
|
+
/**
|
|
508
|
+
* Request for user input from the agent (enables ask_user tool).
|
|
509
|
+
*/
|
|
510
|
+
export interface SquadUserInputRequest {
|
|
511
|
+
/** The question to ask the user */
|
|
512
|
+
question: string;
|
|
513
|
+
/** Optional choices for multiple choice questions */
|
|
514
|
+
choices?: string[];
|
|
515
|
+
/**
|
|
516
|
+
* Whether to allow freeform text input in addition to choices.
|
|
517
|
+
* @default true
|
|
518
|
+
*/
|
|
519
|
+
allowFreeform?: boolean;
|
|
520
|
+
}
|
|
521
|
+
/**
|
|
522
|
+
* Response to a user input request.
|
|
523
|
+
*/
|
|
524
|
+
export interface SquadUserInputResponse {
|
|
525
|
+
/** The user's answer */
|
|
526
|
+
answer: string;
|
|
527
|
+
/** Whether the answer was freeform (not from choices) */
|
|
528
|
+
wasFreeform: boolean;
|
|
529
|
+
}
|
|
530
|
+
/**
|
|
531
|
+
* Handler for user input requests from the agent.
|
|
532
|
+
*/
|
|
533
|
+
export type SquadUserInputHandler = (request: SquadUserInputRequest, invocation: {
|
|
534
|
+
sessionId: string;
|
|
535
|
+
}) => Promise<SquadUserInputResponse> | SquadUserInputResponse;
|
|
536
|
+
/**
|
|
537
|
+
* Configuration for a custom API provider (BYOK - Bring Your Own Key).
|
|
538
|
+
*/
|
|
539
|
+
export interface SquadProviderConfig {
|
|
540
|
+
/**
|
|
541
|
+
* Provider type.
|
|
542
|
+
* @default "openai"
|
|
543
|
+
*/
|
|
544
|
+
type?: "openai" | "azure" | "anthropic";
|
|
545
|
+
/**
|
|
546
|
+
* API format (openai/azure only).
|
|
547
|
+
* @default "completions"
|
|
548
|
+
*/
|
|
549
|
+
wireApi?: "completions" | "responses";
|
|
550
|
+
/** API endpoint URL */
|
|
551
|
+
baseUrl: string;
|
|
552
|
+
/** API key (optional for local providers like Ollama) */
|
|
553
|
+
apiKey?: string;
|
|
554
|
+
/**
|
|
555
|
+
* Bearer token for authentication.
|
|
556
|
+
* Takes precedence over apiKey when both are set.
|
|
557
|
+
*/
|
|
558
|
+
bearerToken?: string;
|
|
559
|
+
/** Azure-specific options */
|
|
560
|
+
azure?: {
|
|
561
|
+
/**
|
|
562
|
+
* API version.
|
|
563
|
+
* @default "2024-10-21"
|
|
564
|
+
*/
|
|
565
|
+
apiVersion?: string;
|
|
566
|
+
};
|
|
567
|
+
}
|
|
568
|
+
/**
|
|
569
|
+
* Configuration for a custom agent in Squad.
|
|
570
|
+
*/
|
|
571
|
+
export interface SquadCustomAgentConfig {
|
|
572
|
+
/** Unique name of the custom agent */
|
|
573
|
+
name: string;
|
|
574
|
+
/** Display name for UI purposes */
|
|
575
|
+
displayName?: string;
|
|
576
|
+
/** Description of what the agent does */
|
|
577
|
+
description?: string;
|
|
578
|
+
/**
|
|
579
|
+
* List of tool names the agent can use.
|
|
580
|
+
* Use null or undefined for all tools.
|
|
581
|
+
*/
|
|
582
|
+
tools?: string[] | null;
|
|
583
|
+
/** The prompt content for the agent */
|
|
584
|
+
prompt: string;
|
|
585
|
+
/** MCP servers specific to this agent */
|
|
586
|
+
mcpServers?: Record<string, SquadMCPServerConfig>;
|
|
587
|
+
/**
|
|
588
|
+
* Whether the agent should be available for model inference.
|
|
589
|
+
* @default true
|
|
590
|
+
*/
|
|
591
|
+
infer?: boolean;
|
|
592
|
+
}
|
|
593
|
+
/**
|
|
594
|
+
* Configuration for infinite sessions with automatic context compaction.
|
|
595
|
+
* When enabled, sessions automatically manage context window limits through
|
|
596
|
+
* background compaction and persist state to a workspace directory.
|
|
597
|
+
*/
|
|
598
|
+
export interface SquadInfiniteSessionConfig {
|
|
599
|
+
/**
|
|
600
|
+
* Whether infinite sessions are enabled.
|
|
601
|
+
* @default true
|
|
602
|
+
*/
|
|
603
|
+
enabled?: boolean;
|
|
604
|
+
/**
|
|
605
|
+
* Context utilization threshold (0.0-1.0) at which background compaction starts.
|
|
606
|
+
* Compaction runs asynchronously, allowing the session to continue.
|
|
607
|
+
* @default 0.80
|
|
608
|
+
*/
|
|
609
|
+
backgroundCompactionThreshold?: number;
|
|
610
|
+
/**
|
|
611
|
+
* Context utilization threshold (0.0-1.0) at which the session blocks until compaction completes.
|
|
612
|
+
* This prevents context overflow when compaction hasn't finished in time.
|
|
613
|
+
* @default 0.95
|
|
614
|
+
*/
|
|
615
|
+
bufferExhaustionThreshold?: number;
|
|
616
|
+
}
|
|
617
|
+
/**
|
|
618
|
+
* Valid reasoning effort levels for models that support it.
|
|
619
|
+
*/
|
|
620
|
+
export type SquadReasoningEffort = "low" | "medium" | "high" | "xhigh";
|
|
621
|
+
/**
|
|
622
|
+
* Session event types emitted by Squad sessions.
|
|
623
|
+
* These events track the session lifecycle and agent activity.
|
|
624
|
+
*/
|
|
625
|
+
export type SquadSessionEventType = string;
|
|
626
|
+
/**
|
|
627
|
+
* Session event payload.
|
|
628
|
+
* Generic event structure that can be specialized per event type.
|
|
629
|
+
*/
|
|
630
|
+
export interface SquadSessionEvent {
|
|
631
|
+
type: SquadSessionEventType;
|
|
632
|
+
[key: string]: unknown;
|
|
633
|
+
}
|
|
634
|
+
/**
|
|
635
|
+
* Handler for session events.
|
|
636
|
+
*/
|
|
637
|
+
export type SquadSessionEventHandler = (event: SquadSessionEvent) => void;
|
|
638
|
+
/**
|
|
639
|
+
* Options for sending a message to a session.
|
|
640
|
+
*/
|
|
641
|
+
export interface SquadMessageOptions {
|
|
642
|
+
/** The prompt/message to send */
|
|
643
|
+
prompt: string;
|
|
644
|
+
/** File, directory, or selection attachments */
|
|
645
|
+
attachments?: Array<{
|
|
646
|
+
type: "file";
|
|
647
|
+
path: string;
|
|
648
|
+
displayName?: string;
|
|
649
|
+
} | {
|
|
650
|
+
type: "directory";
|
|
651
|
+
path: string;
|
|
652
|
+
displayName?: string;
|
|
653
|
+
} | {
|
|
654
|
+
type: "selection";
|
|
655
|
+
filePath: string;
|
|
656
|
+
displayName: string;
|
|
657
|
+
selection?: {
|
|
658
|
+
start: {
|
|
659
|
+
line: number;
|
|
660
|
+
character: number;
|
|
661
|
+
};
|
|
662
|
+
end: {
|
|
663
|
+
line: number;
|
|
664
|
+
character: number;
|
|
665
|
+
};
|
|
666
|
+
};
|
|
667
|
+
text?: string;
|
|
668
|
+
}>;
|
|
669
|
+
/**
|
|
670
|
+
* Message delivery mode.
|
|
671
|
+
* - "enqueue": Add to queue (default)
|
|
672
|
+
* - "immediate": Send immediately
|
|
673
|
+
*/
|
|
674
|
+
mode?: "enqueue" | "immediate";
|
|
675
|
+
}
|
|
676
|
+
/**
|
|
677
|
+
* Squad session interface.
|
|
678
|
+
* Represents an active agent session with lifecycle management.
|
|
679
|
+
*/
|
|
680
|
+
export interface SquadSession {
|
|
681
|
+
/** Unique identifier for this session */
|
|
682
|
+
readonly sessionId: string;
|
|
683
|
+
/**
|
|
684
|
+
* Send a message to the session.
|
|
685
|
+
* @param options - Message content and delivery options
|
|
686
|
+
* @returns Promise that resolves when the message is processed
|
|
687
|
+
*/
|
|
688
|
+
sendMessage(options: SquadMessageOptions): Promise<void>;
|
|
689
|
+
/**
|
|
690
|
+
* Register an event handler for session events.
|
|
691
|
+
* @param eventType - Type of event to listen for
|
|
692
|
+
* @param handler - Handler function to call when event occurs
|
|
693
|
+
*/
|
|
694
|
+
on(eventType: SquadSessionEventType, handler: SquadSessionEventHandler): void;
|
|
695
|
+
/**
|
|
696
|
+
* Remove an event handler.
|
|
697
|
+
* @param eventType - Type of event to stop listening for
|
|
698
|
+
* @param handler - Handler function to remove
|
|
699
|
+
*/
|
|
700
|
+
off(eventType: SquadSessionEventType, handler: SquadSessionEventHandler): void;
|
|
701
|
+
/**
|
|
702
|
+
* End the session and clean up resources.
|
|
703
|
+
* @returns Promise that resolves when session is fully closed
|
|
704
|
+
*/
|
|
705
|
+
close(): Promise<void>;
|
|
706
|
+
}
|
|
707
|
+
/**
|
|
708
|
+
* Session metadata returned from list operations.
|
|
709
|
+
*/
|
|
710
|
+
export interface SquadSessionMetadata {
|
|
711
|
+
sessionId: string;
|
|
712
|
+
startTime: Date;
|
|
713
|
+
modifiedTime: Date;
|
|
714
|
+
summary?: string;
|
|
715
|
+
isRemote: boolean;
|
|
716
|
+
context?: Record<string, unknown>;
|
|
717
|
+
}
|
|
718
|
+
/**
|
|
719
|
+
* Response from getStatus operation.
|
|
720
|
+
*/
|
|
721
|
+
export interface SquadGetStatusResponse {
|
|
722
|
+
version: string;
|
|
723
|
+
protocolVersion: number;
|
|
724
|
+
}
|
|
725
|
+
/**
|
|
726
|
+
* Response from getAuthStatus operation.
|
|
727
|
+
*/
|
|
728
|
+
export interface SquadGetAuthStatusResponse {
|
|
729
|
+
isAuthenticated: boolean;
|
|
730
|
+
authType?: "user" | "env" | "gh-cli" | "hmac" | "api-key" | "token";
|
|
731
|
+
host?: string;
|
|
732
|
+
login?: string;
|
|
733
|
+
statusMessage?: string;
|
|
734
|
+
}
|
|
735
|
+
/**
|
|
736
|
+
* Model capabilities and limits.
|
|
737
|
+
*/
|
|
738
|
+
export interface SquadModelCapabilities {
|
|
739
|
+
supports: {
|
|
740
|
+
vision: boolean;
|
|
741
|
+
reasoningEffort: boolean;
|
|
742
|
+
};
|
|
743
|
+
limits: {
|
|
744
|
+
max_prompt_tokens?: number;
|
|
745
|
+
max_context_window_tokens: number;
|
|
746
|
+
vision?: {
|
|
747
|
+
supported_media_types: string[];
|
|
748
|
+
max_prompt_images: number;
|
|
749
|
+
max_prompt_image_size: number;
|
|
750
|
+
};
|
|
751
|
+
};
|
|
752
|
+
}
|
|
753
|
+
/**
|
|
754
|
+
* Model policy state.
|
|
755
|
+
*/
|
|
756
|
+
export interface SquadModelPolicy {
|
|
757
|
+
state: "enabled" | "disabled" | "unconfigured";
|
|
758
|
+
terms: string;
|
|
759
|
+
}
|
|
760
|
+
/**
|
|
761
|
+
* Model billing information.
|
|
762
|
+
*/
|
|
763
|
+
export interface SquadModelBilling {
|
|
764
|
+
multiplier: number;
|
|
765
|
+
}
|
|
766
|
+
/**
|
|
767
|
+
* Information about an available model.
|
|
768
|
+
*/
|
|
769
|
+
export interface SquadModelInfo {
|
|
770
|
+
id: string;
|
|
771
|
+
name: string;
|
|
772
|
+
capabilities: SquadModelCapabilities;
|
|
773
|
+
policy?: SquadModelPolicy;
|
|
774
|
+
billing?: SquadModelBilling;
|
|
775
|
+
supportedReasoningEfforts?: SquadReasoningEffort[];
|
|
776
|
+
defaultReasoningEffort?: SquadReasoningEffort;
|
|
777
|
+
}
|
|
778
|
+
export {};
|
|
779
|
+
//# sourceMappingURL=types.d.ts.map
|