@agentproto/runtime 2.11.0 → 2.12.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 +26 -0
- package/dist/catalog-models.d.ts +1 -1
- package/dist/catalog-models.mjs.map +1 -1
- package/dist/config.d.ts +1 -1
- package/dist/index.d.ts +167 -5
- package/dist/index.mjs +7871 -6376
- package/dist/index.mjs.map +1 -1
- package/dist/pr-provenance.d.ts +26 -1
- package/dist/pr-provenance.mjs +20 -3
- package/dist/pr-provenance.mjs.map +1 -1
- package/dist/resume-strategies.mjs.map +1 -1
- package/dist/{spawn-defaults-DUnTfwVK.d.ts → spawn-defaults-D4W661ui.d.ts} +8 -0
- package/dist/tool-envelope.d.ts +42 -0
- package/dist/tool-envelope.mjs +60 -0
- package/dist/tool-envelope.mjs.map +1 -0
- package/package.json +23 -17
package/dist/index.d.ts
CHANGED
|
@@ -13,8 +13,8 @@ export { CostBudget, CostBudgetScope } from '@agentproto/auth';
|
|
|
13
13
|
import { R as ResolvedContextContinuityPolicy } from './context-continuity-ib9_bVYM.js';
|
|
14
14
|
import { SandboxMode } from '@agentproto/command-sandbox';
|
|
15
15
|
import { AdapterHandle, SetupField, AdapterResolver, AdapterLister, HarnessCapabilities, AdapterEntry } from '@agentproto/provider-kit';
|
|
16
|
-
import { R as ResolvedAuthSpec, D as DeclaredAdapterOption, A as AdapterAuthDescriptor } from './spawn-defaults-
|
|
17
|
-
export { a as AuthEcho, b as AuthResolutionError, C as CLAUDE_CODE_OAUTH_SOURCE, c as CredentialSource, d as DefaultsAdapterAuthConfig, e as DefaultsAdapterConfig, f as ResolveSubscriptionCredentialInput, g as ResolvedSpawnAuthMaterial, h as ResolvedSpawnDefaults, S as SpawnDefaultsConfig, i as SubscriptionCredentialResolution, j as SubscriptionSourceError, k as credentialFingerprint, n as normalizeSkillsOption, r as resolveAuthSpec, l as resolveSpawnDefaults, m as resolveSubscriptionCredential } from './spawn-defaults-
|
|
16
|
+
import { R as ResolvedAuthSpec, D as DeclaredAdapterOption, A as AdapterAuthDescriptor } from './spawn-defaults-D4W661ui.js';
|
|
17
|
+
export { a as AuthEcho, b as AuthResolutionError, C as CLAUDE_CODE_OAUTH_SOURCE, c as CredentialSource, d as DefaultsAdapterAuthConfig, e as DefaultsAdapterConfig, f as ResolveSubscriptionCredentialInput, g as ResolvedSpawnAuthMaterial, h as ResolvedSpawnDefaults, S as SpawnDefaultsConfig, i as SubscriptionCredentialResolution, j as SubscriptionSourceError, k as credentialFingerprint, n as normalizeSkillsOption, r as resolveAuthSpec, l as resolveSpawnDefaults, m as resolveSubscriptionCredential } from './spawn-defaults-D4W661ui.js';
|
|
18
18
|
import { CatalogModelsQuery, CatalogModelsResponse } from './catalog-models.js';
|
|
19
19
|
export { CatalogAdapterInput, CatalogAdapterModelInput, CatalogPricing, CatalogProduct, CatalogRoute, CatalogRouteSummary, CatalogVendor, buildCatalogModels } from './catalog-models.js';
|
|
20
20
|
import { FooterSession } from './pr-provenance.js';
|
|
@@ -1684,7 +1684,7 @@ declare function createTaskLedger(opts: {
|
|
|
1684
1684
|
* and session_monitor MCP tool (long-poll multiplexed).
|
|
1685
1685
|
*/
|
|
1686
1686
|
|
|
1687
|
-
type SessionEventType = "session:turn-end" | "session:awaiting-input" | "session:awaiting-input-flagged" | "session:permission-request" | "session:permission-resolved" | "session:exited" | "session:reaped" | "session:stalled" | "session:stall-cleared" | "session:watcher-attached" | "session:watcher-detached" | "session:bg-tasks-parked" | "session:bg-tasks-cleared" | "session:resumed" | "session:spawned" | "session:command-done" | "session:model-changed" | "session:config-changed" | "session:renamed" | "session:pinned-changed" | "policy:passed" | "policy:failed" | "policy:commit-ready" | "policy:committed" | "cron:fired" | "cron:succeeded" | "cron:failed" | "activity:changed" | "task:changed";
|
|
1687
|
+
type SessionEventType = "session:turn-end" | "session:awaiting-input" | "session:awaiting-input-flagged" | "session:awaiting-question-answered" | "session:permission-request" | "session:permission-resolved" | "session:exited" | "session:reaped" | "session:stalled" | "session:stall-cleared" | "session:watcher-attached" | "session:watcher-detached" | "session:bg-tasks-parked" | "session:bg-tasks-cleared" | "session:resumed" | "session:spawned" | "session:command-done" | "session:model-changed" | "session:config-changed" | "session:renamed" | "session:pinned-changed" | "policy:passed" | "policy:failed" | "policy:commit-ready" | "policy:committed" | "cron:fired" | "cron:succeeded" | "cron:failed" | "activity:changed" | "task:changed" | "workflow:gate-report" | "session:harness-warning";
|
|
1688
1688
|
/**
|
|
1689
1689
|
* Fixed severity vocabulary for a judge-gate finding (WP-D). Deliberately
|
|
1690
1690
|
* small and fixed so `policy_status` output is comparable across different
|
|
@@ -1813,6 +1813,26 @@ interface SessionPermissionRequestEvent {
|
|
|
1813
1813
|
label?: string;
|
|
1814
1814
|
ts: string;
|
|
1815
1815
|
}
|
|
1816
|
+
/**
|
|
1817
|
+
* Emitted when a client's next prompt text matched one of a structured
|
|
1818
|
+
* `awaitingQuestion`'s `options` (case-insensitive, trimmed) and was
|
|
1819
|
+
* therefore treated as an answer instead of a normal turn — see
|
|
1820
|
+
* `sessions.ts`'s structured-question-answer dispatch. Distinct from
|
|
1821
|
+
* `session:awaiting-input-flagged`: that fires for an EXTERNAL manual
|
|
1822
|
+
* override of the flag; this fires when the session's own declared options
|
|
1823
|
+
* were used as intended, by whichever seam the prompt came through
|
|
1824
|
+
* (`agent_prompt`, the HTTP prompt route, or the CLI).
|
|
1825
|
+
*/
|
|
1826
|
+
interface SessionAwaitingQuestionAnsweredEvent {
|
|
1827
|
+
type: "session:awaiting-question-answered";
|
|
1828
|
+
sessionId: string;
|
|
1829
|
+
/** The matched option string, verbatim from `question.options`. */
|
|
1830
|
+
answer: string;
|
|
1831
|
+
/** The question that was answered. */
|
|
1832
|
+
question: SessionAwaitingQuestion;
|
|
1833
|
+
label?: string;
|
|
1834
|
+
ts: string;
|
|
1835
|
+
}
|
|
1816
1836
|
/**
|
|
1817
1837
|
* Emitted when a parked permission is resolved — by an inbox
|
|
1818
1838
|
* approve/deny, or auto-`cancelled` when the session is torn down while the
|
|
@@ -2272,7 +2292,72 @@ interface TaskChangedEvent {
|
|
|
2272
2292
|
sessionId?: string;
|
|
2273
2293
|
ts: string;
|
|
2274
2294
|
}
|
|
2275
|
-
|
|
2295
|
+
/**
|
|
2296
|
+
* Emitted by the workflow runner (`workflow-runner.ts`) for every `kind:
|
|
2297
|
+
* "gate"` step command attempt — not just the last — carrying that attempt's
|
|
2298
|
+
* pass/fail, exit code, and parsed report (AIP-15 P3). Rides the same bus
|
|
2299
|
+
* fan-out as every other lifecycle event (`session_events_poll`, the
|
|
2300
|
+
* webhook notifier, `session_monitor`), giving a live watcher visibility
|
|
2301
|
+
* into a retry-with-reprompt loop as it happens, not just its final state.
|
|
2302
|
+
*/
|
|
2303
|
+
interface WorkflowGateReportEvent {
|
|
2304
|
+
type: "workflow:gate-report";
|
|
2305
|
+
runId: string;
|
|
2306
|
+
stepId: string;
|
|
2307
|
+
ok: boolean;
|
|
2308
|
+
exitCode: number;
|
|
2309
|
+
report: unknown;
|
|
2310
|
+
attempt: number;
|
|
2311
|
+
ts: string;
|
|
2312
|
+
}
|
|
2313
|
+
/**
|
|
2314
|
+
* Emitted by the workflow runner (`workflow-runner.ts`) when a `kind:
|
|
2315
|
+
* "approval"` step parks its run awaiting a human decision — the run's
|
|
2316
|
+
* status flips to `awaiting-approval`, `workflow_status` carries
|
|
2317
|
+
* `awaitingApproval`, and `workflow_escalation_resolve` (approval form)
|
|
2318
|
+
* resolves it. Same bus distribution as every other lifecycle event.
|
|
2319
|
+
*/
|
|
2320
|
+
interface WorkflowApprovalRequestedEvent {
|
|
2321
|
+
type: "workflow:approval-requested";
|
|
2322
|
+
runId: string;
|
|
2323
|
+
approvalId: string;
|
|
2324
|
+
stepId: string;
|
|
2325
|
+
prompt: string;
|
|
2326
|
+
approvers: readonly string[];
|
|
2327
|
+
artifacts?: readonly string[];
|
|
2328
|
+
requestedAt: string;
|
|
2329
|
+
ts: string;
|
|
2330
|
+
}
|
|
2331
|
+
/**
|
|
2332
|
+
* Emitted by the workflow runner when a parked approval is resolved — by a
|
|
2333
|
+
* human (`workflow_escalation_resolve`), a timeout (`who: "timeout"`), or a
|
|
2334
|
+
* cancel. The run resumes (or unwinds) right after this fires.
|
|
2335
|
+
*/
|
|
2336
|
+
interface WorkflowApprovalResolvedEvent {
|
|
2337
|
+
type: "workflow:approval-resolved";
|
|
2338
|
+
runId: string;
|
|
2339
|
+
approvalId: string;
|
|
2340
|
+
stepId: string;
|
|
2341
|
+
approved: boolean;
|
|
2342
|
+
who: string;
|
|
2343
|
+
note?: string;
|
|
2344
|
+
ts: string;
|
|
2345
|
+
}
|
|
2346
|
+
/**
|
|
2347
|
+
* Emitted when a `kind: "agent"` step's `harness` block declared a field the
|
|
2348
|
+
* spawn couldn't honor (today: `harness.tools` — no adapter exposes a
|
|
2349
|
+
* generic per-spawn tool allowlist this runtime can drive; see
|
|
2350
|
+
* `AgentHarness.tools`'s doc) — the "never silently ignore" fallback AIP-15
|
|
2351
|
+
* P2 requires. Same bus distribution as every other lifecycle event.
|
|
2352
|
+
*/
|
|
2353
|
+
interface SessionHarnessWarningEvent {
|
|
2354
|
+
type: "session:harness-warning";
|
|
2355
|
+
sessionId: string;
|
|
2356
|
+
warnings: string[];
|
|
2357
|
+
label?: string;
|
|
2358
|
+
ts: string;
|
|
2359
|
+
}
|
|
2360
|
+
type SessionEvent = SessionTurnEndEvent | SessionAwaitingInputEvent | SessionAwaitingInputFlaggedEvent | SessionAwaitingQuestionAnsweredEvent | SessionPermissionRequestEvent | SessionPermissionResolvedEvent | SessionExitedEvent | SessionReapedEvent | SessionStalledEvent | SessionStallClearedEvent | SessionWatcherAttachedEvent | SessionWatcherDetachedEvent | SessionBgTasksParkedEvent | SessionBgTasksClearedEvent | SessionResumedEvent | SessionSpawnedEvent | SessionCommandDoneEvent | SessionModelChangedEvent | SessionConfigChangedEvent | SessionRenamedEvent | SessionPinnedEvent | PolicyPassedEvent | PolicyFailedEvent | PolicyCommitReadyEvent | PolicyCommittedEvent | CronFiredEvent | CronSucceededEvent | CronFailedEvent | ActivityChangedEvent | TaskChangedEvent | WorkflowGateReportEvent | WorkflowApprovalRequestedEvent | WorkflowApprovalResolvedEvent | SessionHarnessWarningEvent;
|
|
2276
2361
|
interface SessionEventBus {
|
|
2277
2362
|
emit(ev: SessionEvent): void;
|
|
2278
2363
|
/** Subscribe to a specific event type. Returns an unsubscribe fn. */
|
|
@@ -3401,6 +3486,23 @@ declare function createActivityProjector(opts: {
|
|
|
3401
3486
|
*/
|
|
3402
3487
|
type AgentsMdMode = "inline" | "pointer" | "absent";
|
|
3403
3488
|
|
|
3489
|
+
/** What a served app records on the session descriptor and echoes in the
|
|
3490
|
+
* spawn result — non-secret, caller-visible. */
|
|
3491
|
+
interface SessionAppServeInfo {
|
|
3492
|
+
/** App id the box's `app_install` registered. */
|
|
3493
|
+
appId: string;
|
|
3494
|
+
/** The in-box app dir that was installed + served. */
|
|
3495
|
+
dir: string;
|
|
3496
|
+
/** Port the UI binds inside the box. */
|
|
3497
|
+
port: number;
|
|
3498
|
+
/** Provider-resolved public URL for the served UI. */
|
|
3499
|
+
url: string;
|
|
3500
|
+
/** True when a probe against `url` answered OK within the readiness
|
|
3501
|
+
* window. False means the URL is the right address but the server had
|
|
3502
|
+
* not answered yet — retry the fetch rather than re-spawning. */
|
|
3503
|
+
ready: boolean;
|
|
3504
|
+
}
|
|
3505
|
+
|
|
3404
3506
|
/**
|
|
3405
3507
|
* Policy layer for `agent_start.worktree` — the config-driven decision of
|
|
3406
3508
|
* WHETHER to isolate a spawn into its own git worktree, kept deliberately
|
|
@@ -3870,6 +3972,17 @@ type AgentAdapterResolver = (slug: string) => Promise<{
|
|
|
3870
3972
|
* no caller-facing `env` passthrough on `agent_start` today, so this is
|
|
3871
3973
|
* daemon-authored only, not a general escape hatch. */
|
|
3872
3974
|
env?: Record<string, string>;
|
|
3975
|
+
/** Absolute paths OUTSIDE the session cwd the adapter's workspace
|
|
3976
|
+
* toolset may READ (never write). Daemon-authored only — used for the
|
|
3977
|
+
* exact AGENTS.md file an inherited (pointer-mode) prompt names, so a
|
|
3978
|
+
* cwd below the repo root can actually read the contract file its
|
|
3979
|
+
* prompt points at instead of erroring
|
|
3980
|
+
* (`path … escapes the workspace`). NOT a general escape hatch: the
|
|
3981
|
+
* driver forwards these to its confinement layer as extra READ paths
|
|
3982
|
+
* and (for the mastra-agent adapter) to `makeWorkspaceTools` as a
|
|
3983
|
+
* read-only grant; writes and sibling reads stay denied. Adapters
|
|
3984
|
+
* that can't model the grant ignore it. */
|
|
3985
|
+
additionalReadPaths?: string[];
|
|
3873
3986
|
}): Promise<AgentSessionLike>;
|
|
3874
3987
|
/** Display label for the descriptor's `command` field. */
|
|
3875
3988
|
commandPreview?: string;
|
|
@@ -3973,6 +4086,11 @@ interface AdapterListEntry {
|
|
|
3973
4086
|
* cli`'s `AdapterInfo.routeSelection` without importing it.
|
|
3974
4087
|
*/
|
|
3975
4088
|
routeSelection?: "free" | "derived-from-model";
|
|
4089
|
+
/** Known-valid model identifiers for this adapter (`@agentproto/cli`'s
|
|
4090
|
+
* `AdapterInfo.models`, forwarded verbatim). Undefined when the lister
|
|
4091
|
+
* behind `AgentAdapterLister` doesn't populate it — `adapter_list`'s
|
|
4092
|
+
* `summary` projection depends on this being present. */
|
|
4093
|
+
models?: string[];
|
|
3976
4094
|
}
|
|
3977
4095
|
type AgentAdapterLister = () => Promise<AdapterListEntry[]>;
|
|
3978
4096
|
/**
|
|
@@ -4291,6 +4409,11 @@ interface AgentStreamEvent {
|
|
|
4291
4409
|
* @agentproto/acp's `StreamEvent`'s `agent-prompt` kind. Harness-shaped
|
|
4292
4410
|
* and untyped; don't assume a stable schema across adapters. */
|
|
4293
4411
|
rawInput?: unknown;
|
|
4412
|
+
/** "agent-prompt" `_meta` bag, e.g. an ACP `requestPermission`'s
|
|
4413
|
+
* `toolCall._meta` (mastra-agent's `mastra-agent/suspendPayload` carries a
|
|
4414
|
+
* submit_plan's plan text there) — see @agentproto/acp's `StreamEvent`'s
|
|
4415
|
+
* `agent-prompt` kind. Harness-shaped and untyped. */
|
|
4416
|
+
_meta?: unknown;
|
|
4294
4417
|
/** "plan" event title — see @agentproto/acp's `StreamEvent`'s `plan` kind. */
|
|
4295
4418
|
title?: string;
|
|
4296
4419
|
/** "plan" event entries — see @agentproto/acp's `StreamEvent`'s `plan` kind. */
|
|
@@ -5207,6 +5330,16 @@ interface SessionDescriptor {
|
|
|
5207
5330
|
/** True when the session has been hard-stopped by the context-continuity
|
|
5208
5331
|
* policy — no new prompt may be admitted. */
|
|
5209
5332
|
contextContinuityHardStopped?: boolean;
|
|
5333
|
+
/** The context percentage at which the user last answered "keep-going" to
|
|
5334
|
+
* the `ask`-mode continue-fresh question. `evaluateContextContinuity`
|
|
5335
|
+
* won't re-raise the same question until `contextPct` climbs past this
|
|
5336
|
+
* value again — otherwise the very next turn-boundary check (context
|
|
5337
|
+
* hasn't moved) would immediately re-ask, since the `ask` state covers
|
|
5338
|
+
* the whole `[compactAtPct, hardStopAtPct)` band, not just the instant it
|
|
5339
|
+
* was crossed. The hard-stop threshold is never suppressed by this — it
|
|
5340
|
+
* is checked ahead of `ask` in `contextContinuityStateForPct` and fires
|
|
5341
|
+
* regardless of any acknowledgment. */
|
|
5342
|
+
contextContinuityAckedAtPct?: number;
|
|
5210
5343
|
/** Id of the most recent checkpoint created for this session. */
|
|
5211
5344
|
checkpointId?: string;
|
|
5212
5345
|
/** When this session was continued fresh, the source session id. */
|
|
@@ -5288,6 +5421,15 @@ interface SessionDescriptor {
|
|
|
5288
5421
|
* default, ephemeral) or `"pause"` (keeps `sandboxId` reconnectable via
|
|
5289
5422
|
* `agent_start.sandbox.reuse`). Only set when `remote` is true. */
|
|
5290
5423
|
sandboxTeardown?: "kill" | "pause";
|
|
5424
|
+
/** App ports exposed at boot time (`SandboxSpec.extraPorts`) — maps port
|
|
5425
|
+
* number to its public URL. Only present for sandbox sessions where the
|
|
5426
|
+
* provider resolved `extraPorts` into `BootedSandbox.ports`. */
|
|
5427
|
+
sandboxPorts?: Record<number, string>;
|
|
5428
|
+
/** WP3 — an app UI served from INSIDE this sandbox session's box
|
|
5429
|
+
* (`agent_start.appServe`): the box-installed appId, the in-box dir, the
|
|
5430
|
+
* serve port, and the provider-resolved public URL. See
|
|
5431
|
+
* `sandbox-app-serve.ts`. */
|
|
5432
|
+
appServe?: SessionAppServeInfo;
|
|
5291
5433
|
}
|
|
5292
5434
|
/**
|
|
5293
5435
|
* Lightweight panel projection of SessionDescriptor for the VS Code Sessions
|
|
@@ -5392,6 +5534,8 @@ interface SessionSummary {
|
|
|
5392
5534
|
remote?: boolean;
|
|
5393
5535
|
sandboxId?: string;
|
|
5394
5536
|
sandboxTeardown?: "kill" | "pause";
|
|
5537
|
+
sandboxPorts?: Record<number, string>;
|
|
5538
|
+
appServe?: SessionAppServeInfo;
|
|
5395
5539
|
}
|
|
5396
5540
|
/**
|
|
5397
5541
|
* Thrown by the lazy resume path when a resumable session has already failed to
|
|
@@ -5515,15 +5659,27 @@ interface PendingPermission {
|
|
|
5515
5659
|
* schema across adapters.
|
|
5516
5660
|
*/
|
|
5517
5661
|
rawInput?: unknown;
|
|
5662
|
+
/**
|
|
5663
|
+
* The tool call's `_meta` (e.g. mastra-agent's `mastra-agent/suspendPayload`
|
|
5664
|
+
* carrying a submit_plan's plan text), carried through from the ACP
|
|
5665
|
+
* `agent-prompt` event's `_meta` field when the driver supplied one.
|
|
5666
|
+
* Harness-shaped and untyped — don't assume a stable schema across adapters.
|
|
5667
|
+
*/
|
|
5668
|
+
_meta?: unknown;
|
|
5518
5669
|
}
|
|
5519
5670
|
/** How a caller resolves a pending permission — an explicit `optionId` wins
|
|
5520
5671
|
* over the `decision`→option mapping (approve → an allow-flavored option,
|
|
5521
5672
|
* deny → a reject-flavored option). `scope: "always"` prefers an
|
|
5522
|
-
* allow-always option when the request offers one.
|
|
5673
|
+
* allow-always option when the request offers one. `feedback` is optional
|
|
5674
|
+
* free text (e.g. "reject, but do X instead") sent alongside the outcome —
|
|
5675
|
+
* the acp client forwards it on the ACP outcome's `_meta`
|
|
5676
|
+
* (`agentproto/feedback`) for adapters that consume it (mastra-agent folds
|
|
5677
|
+
* it into a suspension's resumeData). */
|
|
5523
5678
|
interface PermissionRespondInput {
|
|
5524
5679
|
decision: "approve" | "deny";
|
|
5525
5680
|
optionId?: string;
|
|
5526
5681
|
scope?: "once" | "always";
|
|
5682
|
+
feedback?: string;
|
|
5527
5683
|
}
|
|
5528
5684
|
type PermissionRespondResult = {
|
|
5529
5685
|
ok: true;
|
|
@@ -6369,6 +6525,12 @@ interface SpawnAgentInput {
|
|
|
6369
6525
|
/** What session close does to the box, when `remote` is true — see
|
|
6370
6526
|
* `SessionDescriptor.sandboxTeardown`. */
|
|
6371
6527
|
sandboxTeardown?: "kill" | "pause";
|
|
6528
|
+
/** Port-to-URL map from the booted sandbox — see
|
|
6529
|
+
* `SessionDescriptor.sandboxPorts`. */
|
|
6530
|
+
sandboxPorts?: Record<number, string>;
|
|
6531
|
+
/** WP3 — in-box app-serve echo (`agent_start.appServe`), recorded verbatim
|
|
6532
|
+
* onto {@link SessionDescriptor.appServe}. See `sandbox-app-serve.ts`. */
|
|
6533
|
+
appServe?: SessionAppServeInfo;
|
|
6372
6534
|
/** True when the driver session was started in permission-hold mode
|
|
6373
6535
|
* (`AgentCliStartOptions.permissionHold`) — its `agent-prompt` events carry
|
|
6374
6536
|
* respondable permission requests. Gates whether the registry registers
|