@a3s-lab/code 3.0.0 → 3.2.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 +45 -0
- package/extra-types.d.ts +56 -0
- package/generated.d.ts +1512 -0
- package/index.d.ts +9 -1469
- package/package.json +12 -9
package/README.md
CHANGED
|
@@ -158,9 +158,54 @@ await session.tasks([
|
|
|
158
158
|
])
|
|
159
159
|
```
|
|
160
160
|
|
|
161
|
+
For automatic subagent delegation, `autoParallel: false` disables automatic
|
|
162
|
+
parallel fan-out while keeping manual `parallel_task` / `session.tasks(...)`
|
|
163
|
+
available:
|
|
164
|
+
|
|
165
|
+
```js
|
|
166
|
+
const session = agent.session('/my-project', {
|
|
167
|
+
autoDelegation: { enabled: true, maxTasks: 4 },
|
|
168
|
+
maxParallelTasks: 8,
|
|
169
|
+
autoParallel: false,
|
|
170
|
+
})
|
|
171
|
+
```
|
|
172
|
+
|
|
161
173
|
Use `session.toolNames()` for names and `session.toolDefinitions()` when a UI
|
|
162
174
|
needs the full model-visible schemas.
|
|
163
175
|
|
|
176
|
+
## Evidence And Artifacts
|
|
177
|
+
|
|
178
|
+
Tool outputs that exceed the inline display budget are retained as session
|
|
179
|
+
artifacts. Use `artifactStoreLimits` to tune retention and `getArtifact(...)`
|
|
180
|
+
to retrieve retained content by URI:
|
|
181
|
+
|
|
182
|
+
```js
|
|
183
|
+
const session = agent.session('/my-project', {
|
|
184
|
+
artifactStoreLimits: { maxArtifacts: 64, maxBytes: 8 * 1024 * 1024 },
|
|
185
|
+
})
|
|
186
|
+
|
|
187
|
+
const artifact = session.getArtifact('a3s://tool-output/read/abc123')
|
|
188
|
+
if (artifact) console.log(artifact.content)
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
External verification systems can attach their reports to the same session
|
|
192
|
+
evidence stream:
|
|
193
|
+
|
|
194
|
+
```js
|
|
195
|
+
session.recordVerificationReports([{
|
|
196
|
+
schema: 'a3s.verification_report.v1',
|
|
197
|
+
subject: 'sdk:tests',
|
|
198
|
+
status: 'passed',
|
|
199
|
+
checks: [{
|
|
200
|
+
id: 'check:sdk',
|
|
201
|
+
kind: 'test',
|
|
202
|
+
description: 'Run SDK tests',
|
|
203
|
+
status: 'passed',
|
|
204
|
+
required: true,
|
|
205
|
+
}],
|
|
206
|
+
}])
|
|
207
|
+
```
|
|
208
|
+
|
|
164
209
|
## Object-Shaped Direct Tools
|
|
165
210
|
|
|
166
211
|
New direct helpers use option objects when the command can grow over time:
|
package/extra-types.d.ts
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hand-authored type declarations that complement the auto-generated
|
|
3
|
+
* `generated.d.ts`. These describe shapes that cross the SDK boundary as
|
|
4
|
+
* JSON (e.g. payloads inside `runs()`, `verificationReports()`,
|
|
5
|
+
* `errorKindJson` strings), not napi-bound objects.
|
|
6
|
+
*
|
|
7
|
+
* Keep field names matching the actual JSON wire format (snake_case where
|
|
8
|
+
* the Rust core serializes that way). Do not move these into Rust source —
|
|
9
|
+
* napi-derive would camelCase them and break consumers parsing the JSON.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Parsed shape of `ToolResult.errorKindJson` / `AgentEvent.errorKindJson`.
|
|
14
|
+
*
|
|
15
|
+
* Use a discriminated union on the `type` field; new variants may be
|
|
16
|
+
* added in future minor releases — callers should match exhaustively on
|
|
17
|
+
* the kinds they care about and fall through to a default branch for
|
|
18
|
+
* unknown ones.
|
|
19
|
+
*/
|
|
20
|
+
export type ToolErrorKind =
|
|
21
|
+
| { type: 'version_conflict'; path: string; expected: string; actual: string | null }
|
|
22
|
+
| { type: 'remote_git_conflict'; code: string; message: string }
|
|
23
|
+
| { type: 'not_found'; path: string }
|
|
24
|
+
| { type: 'invalid_argument'; message: string }
|
|
25
|
+
| { type: 'unsupported'; message: string }
|
|
26
|
+
| { type: 'timeout'; op: string; duration_ms: number }
|
|
27
|
+
|
|
28
|
+
export type VerificationStatus = 'passed' | 'failed' | 'needs_review' | 'skipped'
|
|
29
|
+
|
|
30
|
+
export interface VerificationCheck {
|
|
31
|
+
id: string
|
|
32
|
+
kind: string
|
|
33
|
+
description: string
|
|
34
|
+
status: VerificationStatus
|
|
35
|
+
required?: boolean
|
|
36
|
+
suggested_tools?: Array<string>
|
|
37
|
+
evidence_uris?: Array<string>
|
|
38
|
+
residual_risk?: string
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export interface VerificationReport {
|
|
42
|
+
schema: string
|
|
43
|
+
subject: string
|
|
44
|
+
status: VerificationStatus
|
|
45
|
+
checks: Array<VerificationCheck>
|
|
46
|
+
residual_risks?: Array<string>
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export interface ToolArtifact {
|
|
50
|
+
artifact_id: string
|
|
51
|
+
artifact_uri: string
|
|
52
|
+
tool_name: string
|
|
53
|
+
content: string
|
|
54
|
+
original_bytes: number
|
|
55
|
+
shown_bytes: number
|
|
56
|
+
}
|