@aaac/runtime 0.2.6 → 0.2.7
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/dist/adapters/adk-sdk.d.ts +1 -1
- package/dist/adapters/claude-agent-sdk.d.ts +8 -1
- package/dist/adapters/claude-agent-sdk.js +105 -72
- package/dist/adapters/claude-agent-sdk.js.map +1 -1
- package/dist/adapters/mock.d.ts +1 -1
- package/dist/adapters/openai-agents-sdk.d.ts +1 -1
- package/dist/{chunk-VJXGCWSZ.js → chunk-MG7WSWJU.js} +16 -1
- package/dist/chunk-MG7WSWJU.js.map +1 -0
- package/dist/index.d.ts +6 -2
- package/dist/index.js +287 -188
- package/dist/index.js.map +1 -1
- package/dist/{task-runner-37cFPFas.d.ts → task-runner-CgQx1KUq.d.ts} +25 -1
- package/package.json +5 -5
- package/dist/chunk-VJXGCWSZ.js.map +0 -1
|
@@ -306,6 +306,28 @@ declare function createLibraryToolRegistry(): LibraryToolRegistry;
|
|
|
306
306
|
*/
|
|
307
307
|
declare function createRegistryFromSdkTools(tools: SdkFunctionTool[]): LibraryToolRegistry;
|
|
308
308
|
|
|
309
|
+
/**
|
|
310
|
+
* AdapterError — an SDK adapter call that failed, with what kind of failure it was.
|
|
311
|
+
*
|
|
312
|
+
* Callers decide what to do from `kind` (log in again, wait for the usage
|
|
313
|
+
* limit, report a timeout) instead of reading the provider's message text.
|
|
314
|
+
*/
|
|
315
|
+
/**
|
|
316
|
+
* - `authentication`: the credentials were rejected (expired login, invalid key)
|
|
317
|
+
* - `rate_limit`: a usage or rate limit was reached
|
|
318
|
+
* - `aborted`: the caller's AbortSignal stopped the call
|
|
319
|
+
* - `other`: any other failure
|
|
320
|
+
*/
|
|
321
|
+
type AdapterErrorKind = "authentication" | "rate_limit" | "aborted" | "other";
|
|
322
|
+
declare class AdapterError extends Error {
|
|
323
|
+
readonly kind: AdapterErrorKind;
|
|
324
|
+
constructor(kind: AdapterErrorKind, message: string, options?: {
|
|
325
|
+
cause?: unknown;
|
|
326
|
+
});
|
|
327
|
+
}
|
|
328
|
+
/** The kind of an error thrown by an adapter call; anything not an AdapterError is `other` */
|
|
329
|
+
declare function adapterErrorKind(error: unknown): AdapterErrorKind;
|
|
330
|
+
|
|
309
331
|
/**
|
|
310
332
|
* Candidate Agents — backend-neutral bridge for LLM-internal routing (model B)
|
|
311
333
|
*
|
|
@@ -704,6 +726,8 @@ type TaskOutcome = {
|
|
|
704
726
|
} | {
|
|
705
727
|
status: "error";
|
|
706
728
|
message: string;
|
|
729
|
+
/** Set when the adapter call failed: what kind of failure it was */
|
|
730
|
+
kind?: AdapterErrorKind;
|
|
707
731
|
};
|
|
708
732
|
/**
|
|
709
733
|
* Retry strategy decision.
|
|
@@ -829,4 +853,4 @@ declare function runTask(adapter: SdkAdapter, taskId: string, context: TaskConte
|
|
|
829
853
|
toolsByAgent?: Map<string, string[]>;
|
|
830
854
|
}): Promise<TaskRunResult>;
|
|
831
855
|
|
|
832
|
-
export {
|
|
856
|
+
export { extractStructuredResult as $, type AdapterSendOptions as A, createExecutionEnvelope as B, type CacheConfig as C, createLibraryToolRegistry as D, type EnvelopeParams as E, createRegistryFromSdkTools as F, emitIterationClose as G, emitIterationMetric as H, InMemoryStore as I, emitIterationOpen as J, emitLlmTurnClose as K, type LibraryToolRegistry as L, type MemoryRef as M, emitLlmTurnOpen as N, type ObserverEmitFn as O, type PromptBuilderOptions as P, emitSessionClose as Q, type RetryDecision as R, type SdkAdapter as S, type TokenUsage as T, emitSessionOpen as U, emitSubagentClose as V, emitSubagentOpen as W, emitToolExecClose as X, emitToolExecOpen as Y, emitToolchainClose as Z, emitToolchainOpen as _, type AgentExecutionRequest as a, renderAgentSystemPrompt as a0, renderAnalyzerExplorationMandatePrompt as a1, runTask as a2, serializeObserverEmit as a3, shouldInjectAnalyzerExplorationMandate as a4, zodSchemaToPromptDescription as a5, zodSchemaToYamlExample as a6, type SdkFunctionTool as b, type ObservabilityIds as c, type TaskOutcome as d, type TaskContractLike as e, type AgentContractLike as f, type TaskContext as g, type MemoryStore as h, type TaskRunResult as i, AdapterError as j, type AdapterErrorKind as k, type AgentProgressEvent as l, type CandidateAgent as m, type InnerSpanOptions as n, type LibraryToolDefinition as o, OBSERVABILITY_ENV_VARS as p, type SplitPrompt as q, type TaskRunOptions as r, adapterErrorKind as s, buildCandidateAgents as t, buildObservabilityEnv as u, buildRetryFollowUp as v, buildSdkFunctionTools as w, buildSplitTaskPrompt as x, buildTaskPrompt as y, collectAnalyzerToolIds as z };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aaac/runtime",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.7",
|
|
4
4
|
"description": "Runtime SDK for the AaaC toolchain",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -68,9 +68,9 @@
|
|
|
68
68
|
"node": ">=22.0.0"
|
|
69
69
|
},
|
|
70
70
|
"dependencies": {
|
|
71
|
-
"@aaac/contracts": "^0.2.
|
|
72
|
-
"@aaac/observability": "^0.2.
|
|
73
|
-
"@aaac/toolchain": "^0.2.
|
|
71
|
+
"@aaac/contracts": "^0.2.7",
|
|
72
|
+
"@aaac/observability": "^0.2.7",
|
|
73
|
+
"@aaac/toolchain": "^0.2.7",
|
|
74
74
|
"agent-contracts": "^0.35.1",
|
|
75
75
|
"commander": "^12.1.0",
|
|
76
76
|
"dotenv": "^17.4.2",
|
|
@@ -102,7 +102,7 @@
|
|
|
102
102
|
"@opentelemetry/api": "^1.9.1",
|
|
103
103
|
"artifact-contracts-analyzer": "^0.3.3",
|
|
104
104
|
"esbuild": "^0.28.0",
|
|
105
|
-
"handlebars": "^4.7.
|
|
105
|
+
"handlebars": "^4.7.10",
|
|
106
106
|
"tsup": "^8.5.0",
|
|
107
107
|
"typescript": "^5.9.0",
|
|
108
108
|
"vitest": "^4.0.0"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/lib/claude-tool-grants.ts"],"sourcesContent":["/**\n * Claude Code built-in tool grant per agent `mode`.\n *\n * ONE definition of \"which Claude Code tools does a `read-only` / `read-write`\n * agent get\". Two consumers, one rule:\n *\n * - in-process: `task-runner.ts` derives `readonly` from `agentContract.mode`\n * and the Claude adapter turns it into the SDK `tools` option.\n * - on-disk: `claude-materialize/agent-render.ts` writes the same names\n * into the `tools:` frontmatter of a materialized `.claude/agents/*.md`\n * subagent (#272).\n *\n * Both must agree — a subagent that Claude Code launches from disk and the same\n * agent delegated to in-process are the same agent, so a divergent tool grant\n * would mean the DSL's `mode` means two different things.\n *\n * `mode` normalization itself lives in `dsl-context.ts` (`buildAgentRegistry`)\n * and is fail-safe: anything that is not exactly `read-write` becomes\n * `read-only`, so an unrecognized mode can never widen the grant.\n */\n\n/** Tools a `read-only` agent may use: inspection + command execution, no writes. */\nexport const READ_ONLY_TOOL_GRANT: readonly string[] = [\"Read\", \"Glob\", \"Grep\", \"Bash\"];\n\n/** Tools a `read-write` agent may use: the read-only set plus the write tools. */\nexport const READ_WRITE_TOOL_GRANT: readonly string[] = [\n \"Read\",\n \"Glob\",\n \"Grep\",\n \"Edit\",\n \"Write\",\n \"Bash\",\n];\n\n/** The Claude Code tool names that mutate the working tree. */\nexport const WRITE_TOOL_NAMES: readonly string[] = READ_WRITE_TOOL_GRANT.filter(\n (t) => !READ_ONLY_TOOL_GRANT.includes(t),\n);\n\n/** Claude Code tool grant for an agent mode. */\nexport function toolGrantForMode(mode: \"read-write\" | \"read-only\"): readonly string[] {\n return mode === \"read-write\" ? READ_WRITE_TOOL_GRANT : READ_ONLY_TOOL_GRANT;\n}\n\n/**\n * The sub-agent delegation tool, canonical spelling. An agent that declares\n * `can_invoke_agents` cannot delegate without it, because neither mode grant\n * includes it. Listing it in a subagent's `tools:` is also what lets that\n * subagent spawn subagents of its own.\n *\n * Claude Code renamed `Task` to `Agent` in 2.1.63; the SDK likewise documents\n * \"a custom subagent that can be invoked via the Agent tool\"\n * (`@anthropic-ai/claude-agent-sdk` sdk.d.ts:36).\n */\nexport const DELEGATION_TOOL_NAME = \"Agent\";\n\n/** Pre-2.1.63 spelling. Claude Code still resolves it as an alias. */\nexport const DELEGATION_TOOL_LEGACY_NAME = \"Task\";\n\n/**\n * Both delegation spellings, granted everywhere.\n *\n * `Agent` does not resolve before Claude Code 2.1.63 and `Task` is the alias\n * that does, so granting only one silently costs the agent its ability to\n * delegate on some installed versions. Granting both is free: a `tools:` list —\n * in a subagent file exactly as in the SDK `tools` option — is an **allowlist**\n * resolved against the available tool pool, and an entry that does not resolve\n * is simply not granted. Only a list where NOTHING resolves fails the launch.\n */\nexport const DELEGATION_TOOL_NAMES: readonly string[] = [\n DELEGATION_TOOL_LEGACY_NAME,\n DELEGATION_TOOL_NAME,\n];\n\n/**\n * The Claude Code tool grant for one agent: its mode grant, plus the delegation\n * tool when the DSL says it may invoke other agents.\n *\n * This is the grant an agent gets wherever it runs — the same rule the adapter\n * applies in-process — so a DSL agent does not gain or lose the ability to\n * delegate depending on whether Claude Code launched it from\n * `.claude/agents/<id>.md` or the runtime registered it as a candidate.\n */\nexport function toolGrantForAgent(agent: {\n mode: \"read-write\" | \"read-only\";\n can_invoke_agents?: readonly string[];\n}): readonly string[] {\n const grant = [...toolGrantForMode(agent.mode)];\n if (agent.can_invoke_agents && agent.can_invoke_agents.length > 0) {\n grant.push(...DELEGATION_TOOL_NAMES);\n }\n return grant;\n}\n"],"mappings":";AAsBO,IAAM,uBAA0C,CAAC,QAAQ,QAAQ,QAAQ,MAAM;AAG/E,IAAM,wBAA2C;AAAA,EACtD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAGO,IAAM,mBAAsC,sBAAsB;AAAA,EACvE,CAAC,MAAM,CAAC,qBAAqB,SAAS,CAAC;AACzC;AAGO,SAAS,iBAAiB,MAAqD;AACpF,SAAO,SAAS,eAAe,wBAAwB;AACzD;AAYO,IAAM,uBAAuB;AAG7B,IAAM,8BAA8B;AAYpC,IAAM,wBAA2C;AAAA,EACtD;AAAA,EACA;AACF;AAWO,SAAS,kBAAkB,OAGZ;AACpB,QAAM,QAAQ,CAAC,GAAG,iBAAiB,MAAM,IAAI,CAAC;AAC9C,MAAI,MAAM,qBAAqB,MAAM,kBAAkB,SAAS,GAAG;AACjE,UAAM,KAAK,GAAG,qBAAqB;AAAA,EACrC;AACA,SAAO;AACT;","names":[]}
|