@agentproto/runtime 5.8.0 → 5.9.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/dist/catalog-models.mjs +38 -2
- package/dist/catalog-models.mjs.map +1 -1
- package/dist/config-schema.mjs +13 -0
- package/dist/config-schema.mjs.map +1 -1
- package/dist/config.mjs +13 -0
- package/dist/config.mjs.map +1 -1
- package/dist/index.d.ts +761 -60
- package/dist/index.mjs +1225 -217
- package/dist/index.mjs.map +1 -1
- package/dist/resume-strategies.d.ts +22 -1
- package/dist/resume-strategies.mjs +2 -1
- package/dist/resume-strategies.mjs.map +1 -1
- package/dist/session-presence.mjs +13 -0
- package/dist/session-presence.mjs.map +1 -1
- package/dist/{sessions-SrISpFsH.d.ts → sessions-Cse9PhLG.d.ts} +102 -6
- package/dist/user-presets.d.ts +1 -1
- package/package.json +9 -9
package/dist/index.d.ts
CHANGED
|
@@ -3,8 +3,8 @@ import { h as WorktreeIsolationMode, i as SpawnAttachMode, j as SpawnDedupeMode,
|
|
|
3
3
|
export { k as DEFAULT_MODEL_ROLES, M as MODEL_ROLE_REF_PREFIX, l as ModelRoleContext, m as ModelRoleEntry, n as ModelRoleSource, o as ModelRoleValue, p as ModelRolesConfig, q as listModelRoles, r as parseModelRoleRef, s as resolveModelRole } from './config-Gz7q9yfJ.js';
|
|
4
4
|
import { B as BuildHeartbeatAgent } from './heartbeat-BJtxbDb9.js';
|
|
5
5
|
export { H as HeartbeatAgent, a as HeartbeatRunner, R as RuntimeEvent, b as RuntimeEvents, p as parseDuration } from './heartbeat-BJtxbDb9.js';
|
|
6
|
-
import { M as MessageUrgency, S as SessionEvent, a as SessionEventType, b as SessionEventBus, c as SessionsRegistry, C as CompletionPolicySupervisor, T as TaskLedger, d as SessionDescriptor, e as SessionEndReason, A as ActivityPolicySlice, f as ActivityListFilter, g as ActivityRecord, h as ActivityTurnSession, i as ActivityPrSession, j as ActivityWorkflowRunSlice, P as PrResolvedState, k as ActivityTaskSlice, W as WorktreeProvisioner, l as AgentsMdResolution, U as UserPreset, R as RestartPolicy, m as SandboxAppServeSpec, n as WorktreeField, o as AgentSessionLike, p as UsageReadContext, q as UsageReadResult, r as MessageKind, s as SessionMessage, t as AgentStreamEvent, u as SessionUsage, v as ToolCallRecord, w as StatsSessionDescriptor, x as ProcRow, y as ProvisionInFlight, z as ProvisionTracker, B as
|
|
7
|
-
export {
|
|
6
|
+
import { M as MessageUrgency, S as SessionEvent, a as SessionEventType, b as SessionEventBus, c as SessionsRegistry, C as CompletionPolicySupervisor, T as TaskLedger, d as SessionDescriptor, e as SessionEndReason, A as ActivityPolicySlice, f as ActivityListFilter, g as ActivityRecord, h as ActivityTurnSession, i as ActivityPrSession, j as ActivityWorkflowRunSlice, P as PrResolvedState, k as ActivityTaskSlice, W as WorktreeProvisioner, l as AgentsMdResolution, U as UserPreset, R as RestartPolicy, m as SandboxAppServeSpec, n as WorktreeField, o as AgentSessionLike, p as UsageReadContext, q as UsageReadResult, r as MessageKind, s as SessionMessage, t as AgentStreamEvent, u as SessionUsage, v as ToolCallRecord, w as StatsSessionDescriptor, x as ProcRow, y as ProvisionInFlight, z as ProvisionTracker, B as SessionCrashReason, D as UsageRollup, E as RemainingQuotaReader, Q as QuotaReadableProfile, F as UsageSnapshotRecord, G as SessionAwaitingQuestion, H as PolicyRunState, I as PtyFactory, J as WorktreeAutoReclaimer } from './sessions-Cse9PhLG.js';
|
|
7
|
+
export { K as ActivityKind, L as ActivitySource, N as ActivityState, O as ActivityWaitingOn, V as AnthropicReaderConfig, X as AnthropicRemainingQuotaReader, Y as AttachPolicyInput, Z as CommandGroupStats, _ as CommitSpec, $ as DEFAULT_WORKTREE_ISOLATION, a0 as DEFAULT_WORKTREE_PROVISION_CONCURRENCY, a1 as EagerResumeFailReason, a2 as EagerResumeOutcome, a3 as EagerResumeSkipReason, a4 as GateSpec, a5 as HostInfo, a6 as JudgeGateSpec, a7 as LabeledProcessStatsReport, a8 as LabeledSessionStats, a9 as MAX_MESSAGE_DATA_BYTES, aa as MESSAGE_KINDS, ab as MESSAGE_PREAMBLE, ac as MESSAGE_TAG, ad as MESSAGE_URGENCIES, ae as MessageDeliveryVia, af as MessageFilter, ag as MessageRelation, ah as MessageTreeNode, ai as OnFailSpec, aj as OrphanGroup, ak as PendingPermission, al as PermissionRespondInput, am as PermissionRespondResult, an as PolicyRunStatus, ao as PricingResolver, ap as ProcessDetail, aq as ProcessStatsReport, ar as ProcessStatsService, as as QuotaStoreFile, at as QuotaStoreOptions, au as RegisterBrowserInput, av as RegisterSessionInput, aw as RemainingQuota, ax as ResourceStats, ay as ResumeDisabledError, az as SESSION_END_REASONS, aA as SESSION_ID_ENV, aB as SessionCurrentPhase, aC as SessionKind, aD as SessionMessageFrom, aE as SessionOutcome, aF as SessionOutcomeArtifact, aG as SessionOutcomeCompact, aH as SessionOutcomeLink, aI as SessionResourceStats, aJ as SessionSnapshots, aK as SessionStatus, aL as ShellGateSpec, aM as SpawnAgentInput, aN as SpawnSessionInput, aO as StatsDetail, aP as StoredProfileQuota, aQ as TASK_STATUSES, aR as TaskCaller, aS as TaskChangedEvent, aT as TaskClaimInput, aU as TaskCreateInput, aV as TaskGateOutcome, aW as TaskGateRunner, aX as TaskLedgerRegistry, aY as TaskLedgerSessionSlice, aZ as TaskListFilter, a_ as TaskRecord, a$ as TaskStatus, b0 as TaskUpdateInput, b1 as TaskVerification, b2 as TaskVerifySupervisor, b3 as TaskWriteResult, b4 as TokenPricing, b5 as UsageBucket, b6 as UsageComputeInput, b7 as UsageDetail, b8 as UsageSource, b9 as UserPresetsFile, ba as WORKSPACE_SLUG_ENV, bb as WORKTREE_ISOLATION_ENV, bc as WORKTREE_PROVISION_CONCURRENCY_ENV, bd as WorktreeDecision, be as WorktreeProvisionOutcome, bf as WorktreeProvisionPhase, bg as WorktreeProvisionProgress, bh as WorktreeProvisionRequest, bi as WorktreeRequest, bj as activityCounts, bk as compactOutcome, bl as createProcessStatsService, bm as createSessionMessage, bn as createSupervisorTaskGateRunner, bo as createTaskLedger, bp as decideWorktreeIsolation, bq as deleteUserPreset, br as deriveSessionOutcome, bs as deriveSessionUsage, bt as escapeHumanPrompt, bu as escapeMessageBody, bv as filterActivities, bw as getProcessStatsService, bx as getUserPreset, by as isClosedTaskStatus, bz as isKnownSessionEndReason, bA as isMessageAllowed, bB as isProviderLimitError, bC as isTerminalActivityState, bD as listUserPresets, bE as loadQuotaStore, bF as loadUserPresets, bG as loadWorktreeIsolation, bH as matchesMessageFilter, bI as messageFrom, bJ as mintMessageId, bK as normalizeCommand, bL as normalizeWorktreeField, bM as parseAnthropicRateLimitHeaders, bN as parseTaskStatus, bO as parseWindow, bP as parseWorktreeIsolationMode, bQ as pickUsageDetail, bR as policyToActivities, bS as policyWatchesSession, bT as prToActivities, bU as projectSessionUsage, bV as readProfileQuota, bW as recordProfileQuota, bX as renderInboxDigest, bY as renderSessionMessage, bZ as renderSessionMessages, b_ as resolveRelation, b$ as rollupUsage, c0 as sanitizeLabel, c1 as saveUserPreset, c2 as trackWorktreeProvision, c3 as turnToActivities, c4 as userPresetsPath, c5 as workflowToActivities } from './sessions-Cse9PhLG.js';
|
|
8
8
|
import { R as RouteSpec, P as Posture, C as ContextProfile, a as CanonicalPosture } from './session-config-DxIIuJFY.js';
|
|
9
9
|
export { A as AuthMethod, D as DeclaredAdapterMode, E as EffortLevel, S as SessionConfig, c as composeMode, d as decomposeMode } from './session-config-DxIIuJFY.js';
|
|
10
10
|
import { AcpMcpServer } from '@agentproto/acp';
|
|
@@ -440,6 +440,112 @@ interface SentinelSpec {
|
|
|
440
440
|
* descriptive, same as `group`. */
|
|
441
441
|
label?: string;
|
|
442
442
|
}
|
|
443
|
+
/** Declared capabilities of a sentinel provider — pure metadata, surfaced in
|
|
444
|
+
* `list_sentinel_adapters`. Never carries secrets. */
|
|
445
|
+
interface SentinelProviderCapabilities {
|
|
446
|
+
/** Subject schemes it can watch, e.g. `["github"]`, or `["*"]`. */
|
|
447
|
+
subjects: string[];
|
|
448
|
+
/** Can deliver by calling back into the daemon (push ingress). */
|
|
449
|
+
push: boolean;
|
|
450
|
+
/** Supports `poll`/`ack`. */
|
|
451
|
+
poll: boolean;
|
|
452
|
+
/** Events survive daemon downtime (hosted queue). */
|
|
453
|
+
durable: boolean;
|
|
454
|
+
/** Push mode requires a reachable daemon (public URL). */
|
|
455
|
+
needsPublicUrl: boolean;
|
|
456
|
+
requiresAuth: boolean;
|
|
457
|
+
/** Documentation only — surfaced in `list_sentinel_adapters`. */
|
|
458
|
+
typicalLatencyMs: number;
|
|
459
|
+
}
|
|
460
|
+
/** Opaque provider-owned state for one sentinel. Persisted on the
|
|
461
|
+
* `Sentinel` record; round-tripped through `create`/`attach`/`cancel`. */
|
|
462
|
+
interface SentinelHandle {
|
|
463
|
+
provider: string;
|
|
464
|
+
/** Remote id — agentpush subscription id, GitHub hook id, … */
|
|
465
|
+
remoteId?: string;
|
|
466
|
+
/** Poll cursor — agentpush seq, local-gh snapshot hash, … */
|
|
467
|
+
cursor?: string;
|
|
468
|
+
state?: Record<string, unknown>;
|
|
469
|
+
}
|
|
470
|
+
/** How the daemon wants events delivered — passed to `create`/`attach` so a
|
|
471
|
+
* provider can register a webhook (push) or just start polling. */
|
|
472
|
+
type DeliveryPreference = {
|
|
473
|
+
mode: "poll";
|
|
474
|
+
intervalMs: number;
|
|
475
|
+
} | {
|
|
476
|
+
mode: "push";
|
|
477
|
+
/** Public daemon origin the provider should call back into. A push
|
|
478
|
+
* provider that owns its own secret/route (the `webhook` provider)
|
|
479
|
+
* ignores or derives both; absent when no public URL is known. */
|
|
480
|
+
callbackUrl?: string;
|
|
481
|
+
secret?: string;
|
|
482
|
+
};
|
|
483
|
+
/** Extra context the runtime/tools hand to `create` beyond the spec. */
|
|
484
|
+
interface SentinelCreateContext {
|
|
485
|
+
/** The id the store will record this sentinel under (`sen_<ulid>`), minted
|
|
486
|
+
* BEFORE `create` so a provider that stamps it remotely (agentpush's
|
|
487
|
+
* `consumerRef`) names the same sentinel the daemon does. */
|
|
488
|
+
sentinelId?: string;
|
|
489
|
+
}
|
|
490
|
+
/** Whether a provider can operate right now, and if not, why. */
|
|
491
|
+
interface SentinelProviderReadiness {
|
|
492
|
+
ready: boolean;
|
|
493
|
+
/** Human-readable, actionable reason when `ready` is false. */
|
|
494
|
+
reason?: string;
|
|
495
|
+
}
|
|
496
|
+
/**
|
|
497
|
+
* A pluggable adapter that turns a sentinel spec into a stream of
|
|
498
|
+
* {@link SentinelEvent}s. Same registry/adapter-kit pattern as the tunnel and
|
|
499
|
+
* sandbox provider families (`AdapterHandle` gives slug/name/version/
|
|
500
|
+
* description/requiresSetup/check).
|
|
501
|
+
*/
|
|
502
|
+
interface SentinelProviderHandle extends AdapterHandle {
|
|
503
|
+
readonly capabilities: SentinelProviderCapabilities;
|
|
504
|
+
/** Credential fields this provider accepts via `setup_sentinel_provider`.
|
|
505
|
+
* Omit (or empty) when the provider needs no credentials. */
|
|
506
|
+
readonly setupFields?: readonly SetupField[];
|
|
507
|
+
/** Start watching. `delivery` tells the provider how the daemon wants
|
|
508
|
+
* events. */
|
|
509
|
+
create(spec: SentinelSpec, delivery: DeliveryPreference, ctx?: SentinelCreateContext): Promise<SentinelHandle>;
|
|
510
|
+
/** Re-attach after a daemon restart (re-point a callback, resume a
|
|
511
|
+
* cursor). */
|
|
512
|
+
attach(handle: SentinelHandle, delivery: DeliveryPreference): Promise<SentinelHandle>;
|
|
513
|
+
cancel(handle: SentinelHandle): Promise<void>;
|
|
514
|
+
status(handle: SentinelHandle): Promise<{
|
|
515
|
+
ok: boolean;
|
|
516
|
+
detail?: string;
|
|
517
|
+
pending?: number;
|
|
518
|
+
}>;
|
|
519
|
+
/** Poll mode: events after `handle.cursor`, oldest first, plus the new
|
|
520
|
+
* cursor. */
|
|
521
|
+
poll?(handle: SentinelHandle, limit: number): Promise<{
|
|
522
|
+
events: SentinelEvent[];
|
|
523
|
+
cursor: string;
|
|
524
|
+
}>;
|
|
525
|
+
ack?(handle: SentinelHandle, cursor: string): Promise<void>;
|
|
526
|
+
/** Push mode: verify + parse one inbound HTTP request into events (called
|
|
527
|
+
* by the `"sentinel"` dialect on `POST /inbound/sentinel-<hookKey>`). */
|
|
528
|
+
parseInbound?(req: {
|
|
529
|
+
rawBody: string;
|
|
530
|
+
headers: Record<string, string | string[] | undefined>;
|
|
531
|
+
}, handle: SentinelHandle): {
|
|
532
|
+
ok: true;
|
|
533
|
+
events: SentinelEvent[];
|
|
534
|
+
} | {
|
|
535
|
+
ok: false;
|
|
536
|
+
reason: string;
|
|
537
|
+
};
|
|
538
|
+
/** Delivery a provider that supports both modes wants by default. Absent =
|
|
539
|
+
* poll when `capabilities.poll`, else push (see {@link deliveryPreferenceFor}). */
|
|
540
|
+
preferredDelivery?(intervalMs: number): DeliveryPreference;
|
|
541
|
+
/** Default `types` for a subject scheme when the spec leaves it undefined. */
|
|
542
|
+
defaultTypes(subject: string): string[];
|
|
543
|
+
/** Optional operational-readiness probe (public URL known, auth scope
|
|
544
|
+
* sufficient, ...). Consulted by `list_sentinel_adapters` and provider
|
|
545
|
+
* auto-selection. Absent = always ready. Never throws — a probe failure
|
|
546
|
+
* is `{ready:false, reason}`. */
|
|
547
|
+
readiness?(): Promise<SentinelProviderReadiness>;
|
|
548
|
+
}
|
|
443
549
|
|
|
444
550
|
/**
|
|
445
551
|
* SentinelStore — persists `~/.agentproto/sentinels.json` (AIP-60 §2).
|
|
@@ -466,6 +572,114 @@ interface SentinelSpec {
|
|
|
466
572
|
*/
|
|
467
573
|
|
|
468
574
|
type SentinelStatus = "active" | "paused" | "expired" | "orphaned" | "error";
|
|
575
|
+
interface Sentinel {
|
|
576
|
+
/** `sen_<ulid>`, daemon-minted. */
|
|
577
|
+
id: string;
|
|
578
|
+
spec: SentinelSpec;
|
|
579
|
+
/** Resolved provider slug (never undefined once created, even when
|
|
580
|
+
* `spec.provider` was left for auto-select). */
|
|
581
|
+
provider: string;
|
|
582
|
+
/** Opaque provider state (remote id, cursor, hook id, …). */
|
|
583
|
+
handle: SentinelHandle;
|
|
584
|
+
status: SentinelStatus;
|
|
585
|
+
createdTs: number;
|
|
586
|
+
lastEventTs?: number;
|
|
587
|
+
eventCount: number;
|
|
588
|
+
lastError?: string;
|
|
589
|
+
/** Last `SEEN_CAP` event ids delivered/skipped for this sentinel — the
|
|
590
|
+
* dedup window (design §2: "last 1000 event ids, dedup across providers/
|
|
591
|
+
* restarts"). */
|
|
592
|
+
seen: string[];
|
|
593
|
+
/** For `spec.until.kind === "subject_terminal"` with more than one
|
|
594
|
+
* `spec.match` clause: the clause subjects that have already seen a
|
|
595
|
+
* terminal event. The sentinel only expires once every clause's subject
|
|
596
|
+
* is present here. Stays `[]` for other `until` kinds (unused) and for a
|
|
597
|
+
* single-clause spec is immediately superseded by expiry on that one
|
|
598
|
+
* clause's terminal event — same behaviour as before multi-clause
|
|
599
|
+
* `match` existed. */
|
|
600
|
+
terminalSubjects: string[];
|
|
601
|
+
/** Concrete event subjects (e.g. `github:o/r#12`) that have already seen a
|
|
602
|
+
* terminal event (PR merged/closed) — any later NON-terminal event for one
|
|
603
|
+
* of them is post-mortem noise (a check_suite failing after the merge) and
|
|
604
|
+
* is parked instead of delivered. Independent of `spec.until`. Absent on
|
|
605
|
+
* sentinels persisted before this field existed. */
|
|
606
|
+
closedSubjects?: string[];
|
|
607
|
+
}
|
|
608
|
+
interface SentinelCreateInput {
|
|
609
|
+
/** Pre-minted id (see {@link mintSentinelId}); minted by the store when
|
|
610
|
+
* omitted. */
|
|
611
|
+
id?: string;
|
|
612
|
+
spec: SentinelSpec;
|
|
613
|
+
provider: string;
|
|
614
|
+
handle: SentinelHandle;
|
|
615
|
+
status?: SentinelStatus;
|
|
616
|
+
}
|
|
617
|
+
type SentinelUpdatePatch = Partial<Pick<Sentinel, "spec" | "provider" | "handle" | "status" | "lastEventTs" | "eventCount" | "lastError" | "terminalSubjects" | "closedSubjects">>;
|
|
618
|
+
/** A `webhook` target's secret sidecar row — the material `signWebhook` and
|
|
619
|
+
* challenge verification need, keyed by the `secretRef` the at-rest target
|
|
620
|
+
* carries. The material NEVER sits inside the `Sentinel` record or any
|
|
621
|
+
* sentinel view (plan §4 W-B task 4); keys are never logged. */
|
|
622
|
+
interface SentinelWebhookSecret {
|
|
623
|
+
/** Current signing secret (`whsec_…`, standard-base64 wire format). */
|
|
624
|
+
secret: string;
|
|
625
|
+
/** Previous secret — kept while a rotation window is open (10 min from
|
|
626
|
+
* `rotatedAt`) so delivery signs with BOTH during renewal. */
|
|
627
|
+
prevSecret?: string;
|
|
628
|
+
/** Wall-clock ms at which `prevSecret` was superseded by `secret`; the
|
|
629
|
+
* dual-sign window is `now - rotatedAt < 10 minutes`. */
|
|
630
|
+
rotatedAt?: number;
|
|
631
|
+
}
|
|
632
|
+
/** What {@link SentinelStore.putSentinelSecret} hands back — the only thing
|
|
633
|
+
* sidecar writes return; never the material. */
|
|
634
|
+
interface SentinelSecretWriteResult {
|
|
635
|
+
ref: string;
|
|
636
|
+
hasPrevSecret: boolean;
|
|
637
|
+
rotatedAt?: number;
|
|
638
|
+
}
|
|
639
|
+
interface SentinelStore {
|
|
640
|
+
get(id: string): Sentinel | undefined;
|
|
641
|
+
list(): Sentinel[];
|
|
642
|
+
create(input: SentinelCreateInput): Sentinel;
|
|
643
|
+
update(id: string, patch: SentinelUpdatePatch): Sentinel | undefined;
|
|
644
|
+
remove(id: string): boolean;
|
|
645
|
+
/** true = first time this event id has been seen for this sentinel
|
|
646
|
+
* (persisted dedup, bounded). Returns true (treat-as-unseen) for an
|
|
647
|
+
* unknown sentinel id — never blocks a caller who already validated the
|
|
648
|
+
* sentinel exists moments earlier.
|
|
649
|
+
*
|
|
650
|
+
* Callers that need at-least-once delivery MUST check {@link isSeen}
|
|
651
|
+
* BEFORE attempting delivery and only call `markSeen` AFTER delivery is
|
|
652
|
+
* handled (delivered or parked) — calling this before delivery and
|
|
653
|
+
* bailing out on a thrown error would dedupe the event out of every
|
|
654
|
+
* future redelivery attempt, silently losing it. */
|
|
655
|
+
markSeen(id: string, eventId: string): boolean;
|
|
656
|
+
/** Read-only check: true = this event id is already in the persisted
|
|
657
|
+
* `seen` window for this sentinel. Never mutates — use this to decide
|
|
658
|
+
* whether an event needs (re)delivery, and only call `markSeen` once
|
|
659
|
+
* delivery has actually been handled. Returns false for an unknown
|
|
660
|
+
* sentinel id (nothing recorded, so nothing has been "seen"). */
|
|
661
|
+
isSeen(id: string, eventId: string): boolean;
|
|
662
|
+
/** Write a webhook secret sidecar row (secret material at rest, 0600
|
|
663
|
+
* sidecar file, keys never logged). When the row's existing `secret`
|
|
664
|
+
* DIFFERS, the old one is kept as `prevSecret` and `rotatedAt` is
|
|
665
|
+
* stamped now — the dual-sign window arithmetic lives on the delivery
|
|
666
|
+
* side. Returns only non-secret metadata; never the secret. */
|
|
667
|
+
putSentinelSecret(ref: string, row: SentinelWebhookSecret): SentinelSecretWriteResult | undefined;
|
|
668
|
+
/** Read a secret sidecar row (delivery path only — never a listing path). */
|
|
669
|
+
getSentinelSecret(ref: string): SentinelWebhookSecret | undefined;
|
|
670
|
+
/** Read-only expiry consultation for `until: {kind:"at"}` — false for
|
|
671
|
+
* every other `until` kind and for an unknown id. Sweeping the status
|
|
672
|
+
* flip belongs to the runtime; this never mutates. */
|
|
673
|
+
isExpired(id: string): boolean;
|
|
674
|
+
/** Solve the `secretRef` for a webhook target: a target still carrying
|
|
675
|
+
* raw `secret` has it moved into the sidecar (fresh ref returned); a
|
|
676
|
+
* target already carrying `secretRef` (at-rest shape) is left as-is and
|
|
677
|
+
* its ref returned. undefined = not a webhook target, or neither
|
|
678
|
+
* secret nor ref present. */
|
|
679
|
+
materializeWebhookTargetRef(target: SentinelTarget): string | undefined;
|
|
680
|
+
/** Synchronous flush for shutdown paths. */
|
|
681
|
+
flushSync(): void;
|
|
682
|
+
}
|
|
469
683
|
|
|
470
684
|
/**
|
|
471
685
|
* LlmEndpointRegistry — supervised-sidecar manager for the
|
|
@@ -5703,6 +5917,211 @@ interface SandboxReconcileResult {
|
|
|
5703
5917
|
*/
|
|
5704
5918
|
declare function reconcileSandboxLedger(deps: SandboxReconcileDeps): Promise<SandboxReconcileResult>;
|
|
5705
5919
|
|
|
5920
|
+
/**
|
|
5921
|
+
* Per-session structured event capture — one append-only JSONL file per
|
|
5922
|
+
* agent-cli session, written at the same tap point where `projectEvent`
|
|
5923
|
+
* (sessions.ts) flattens `StreamEvent`s into the ANSI ring buffer, but
|
|
5924
|
+
* BEFORE that flattening happens. Gives agentproto the Claude-Code
|
|
5925
|
+
* property: a daemon-owned structured transcript that survives a daemon
|
|
5926
|
+
* restart (the ring buffer doesn't) and that any frontend can render,
|
|
5927
|
+
* not just the two adapters `transcript-export.ts` knows how to re-read
|
|
5928
|
+
* from their own native stores.
|
|
5929
|
+
*
|
|
5930
|
+
* File layout: `~/.agentproto/sessions/<sessionId>/events.jsonl` (the
|
|
5931
|
+
* root is overridable via the daemon config's `sessions.eventsDir` — see
|
|
5932
|
+
* `setDefaultSessionsBaseDir`), one JSON object per line: `{seq, ts, kind, ...fields}`.
|
|
5933
|
+
*
|
|
5934
|
+
* PTY (`terminal`) and `command` sessions never call into this writer —
|
|
5935
|
+
* they have no structured event source (see report-transcript-
|
|
5936
|
+
* architecture.md finding C.17), so this module is only ever driven from
|
|
5937
|
+
* `agent-cli` sessions' `runAgentTurn`.
|
|
5938
|
+
*/
|
|
5939
|
+
|
|
5940
|
+
/** Point the no-`baseDir` path resolution at `dir`. Called once at daemon
|
|
5941
|
+
* boot from the loaded config (`sessions.eventsDir`); `undefined` restores
|
|
5942
|
+
* the hardcoded `~/.agentproto/sessions` default. Relative paths are
|
|
5943
|
+
* resolved against the home directory. */
|
|
5944
|
+
declare function setDefaultSessionsBaseDir(dir: string | undefined): void;
|
|
5945
|
+
/** The effective default base dir — the configured one, or the hardcoded
|
|
5946
|
+
* `~/.agentproto/sessions`. */
|
|
5947
|
+
declare function defaultTranscriptBaseDir(): string;
|
|
5948
|
+
declare function sessionTranscriptDir(sessionId: string, baseDir?: string): string;
|
|
5949
|
+
declare function sessionEventsPath(sessionId: string, baseDir?: string): string;
|
|
5950
|
+
|
|
5951
|
+
/**
|
|
5952
|
+
* Per-session index sidecar — a compact `<sessionsDir>/<id>/index.json`
|
|
5953
|
+
* projection of every session dir under the sessions store, maintained
|
|
5954
|
+
* best-effort on every write-path event (create/rename/turn-end/exit) and
|
|
5955
|
+
* backfilled at daemon startup for sessions that predate the sidecar.
|
|
5956
|
+
*
|
|
5957
|
+
* WHY: recovering a session by its user-visible label (or its cwd, or an id
|
|
5958
|
+
* prefix) used to require `grep -r` across the whole sessions store and a
|
|
5959
|
+
* hand-rolled parse of a multi-thousand-line `events.jsonl`. Everything was
|
|
5960
|
+
* in the jsonl, but answering "which session was that?" meant loading every
|
|
5961
|
+
* file whole. The sidecar turns that into one small JSON read per session
|
|
5962
|
+
* (`sessions find`) and a single bounded tail read for the "where did we
|
|
5963
|
+
* stop" recap (`sessions recap`).
|
|
5964
|
+
*
|
|
5965
|
+
* INVARIANTS:
|
|
5966
|
+
* - additive: `events.jsonl`'s format is never touched; this is a sidecar.
|
|
5967
|
+
* - best-effort: a failed index write must never fail a session write.
|
|
5968
|
+
* - bounded: reads seek from the end and cap the window ({@link INDEX_TAIL_BYTES});
|
|
5969
|
+
* a whole-file read of `events.jsonl` is never performed here.
|
|
5970
|
+
* - throttled: the registry schedules index writes rather than doing one
|
|
5971
|
+
* per streaming frame (see `scheduleIndexWrite` in sessions.ts).
|
|
5972
|
+
*
|
|
5973
|
+
* Pure by construction apart from the explicit read/write helpers; the
|
|
5974
|
+
* registry owns the scheduling, this module owns the shape and the disk.
|
|
5975
|
+
*/
|
|
5976
|
+
|
|
5977
|
+
/** Hard cap on `lastUserPrompt.text`, in characters. */
|
|
5978
|
+
declare const INDEX_MAX_PROMPT = 500;
|
|
5979
|
+
/** Hard cap on `lastOutputText`, in characters. */
|
|
5980
|
+
declare const INDEX_MAX_OUTPUT = 300;
|
|
5981
|
+
/** How many bytes of `events.jsonl` a tail read may pull back from the end.
|
|
5982
|
+
* Bounded so a multi-MB transcript never turns a find/recap into a scan. */
|
|
5983
|
+
declare const INDEX_TAIL_BYTES: number;
|
|
5984
|
+
/** Default page size for `sessions find` / `session_search`. */
|
|
5985
|
+
declare const INDEX_DEFAULT_LIMIT = 20;
|
|
5986
|
+
/** The compact sidecar shape. Every field is optional except `id`/`kind`/
|
|
5987
|
+
* `status`/`alive`/`startedAt`, so a recovered-from-jsonl entry can be
|
|
5988
|
+
* partial without lying about what it knows. */
|
|
5989
|
+
interface SessionIndexEntry {
|
|
5990
|
+
id: string;
|
|
5991
|
+
label?: string;
|
|
5992
|
+
title?: string;
|
|
5993
|
+
renamedByUser?: boolean;
|
|
5994
|
+
kind: string;
|
|
5995
|
+
status: string;
|
|
5996
|
+
alive: boolean;
|
|
5997
|
+
adapter?: string;
|
|
5998
|
+
model?: string;
|
|
5999
|
+
cwd?: string;
|
|
6000
|
+
workspaceSlug?: string;
|
|
6001
|
+
origin?: string;
|
|
6002
|
+
depth?: number;
|
|
6003
|
+
parentSessionId?: string;
|
|
6004
|
+
startedAt: string;
|
|
6005
|
+
lastActivityAt?: string;
|
|
6006
|
+
lastTurnReason?: string;
|
|
6007
|
+
lastUserPrompt?: {
|
|
6008
|
+
ts: string;
|
|
6009
|
+
text: string;
|
|
6010
|
+
};
|
|
6011
|
+
lastOutputText?: string;
|
|
6012
|
+
turnsCompleted?: number;
|
|
6013
|
+
costUsd?: number;
|
|
6014
|
+
}
|
|
6015
|
+
/** One user prompt recovered from a transcript tail. */
|
|
6016
|
+
interface TranscriptPrompt {
|
|
6017
|
+
ts: string;
|
|
6018
|
+
text: string;
|
|
6019
|
+
}
|
|
6020
|
+
/** The bounded tail-read result: parsed prompts, the last assistant run, and
|
|
6021
|
+
* how many bytes were actually read (exposed so a test can prove the read
|
|
6022
|
+
* stayed within {@link INDEX_TAIL_BYTES}). */
|
|
6023
|
+
interface TranscriptTail {
|
|
6024
|
+
prompts: TranscriptPrompt[];
|
|
6025
|
+
lastOutputText?: string;
|
|
6026
|
+
bytesRead: number;
|
|
6027
|
+
/** `ts` of the first parseable record in the window, when it carries one. */
|
|
6028
|
+
firstTs?: string;
|
|
6029
|
+
}
|
|
6030
|
+
/** Absolute path of one session's index sidecar. */
|
|
6031
|
+
declare function sessionIndexPath(sessionId: string, baseDir?: string): string;
|
|
6032
|
+
/** Build the sidecar entry from a live/persisted descriptor, filling the
|
|
6033
|
+
* transcript-derived fields (`lastUserPrompt`/`lastOutputText`) from the
|
|
6034
|
+
* caller when it has them. */
|
|
6035
|
+
declare function indexEntryFromDescriptor(desc: SessionDescriptor, extra?: {
|
|
6036
|
+
lastUserPrompt?: TranscriptPrompt;
|
|
6037
|
+
lastOutputText?: string;
|
|
6038
|
+
}): SessionIndexEntry;
|
|
6039
|
+
/** Read one session's sidecar. Returns undefined on ENOENT, malformed JSON,
|
|
6040
|
+
* or a shape missing its id — never throws. */
|
|
6041
|
+
declare function readSessionIndex(sessionId: string, baseDir?: string): SessionIndexEntry | undefined;
|
|
6042
|
+
/** Atomically write one session's sidecar (tmp + rename). Best-effort:
|
|
6043
|
+
* swallows every error — a failed index write must never fail a session
|
|
6044
|
+
* write. */
|
|
6045
|
+
declare function writeSessionIndex(entry: SessionIndexEntry, baseDir?: string): void;
|
|
6046
|
+
/**
|
|
6047
|
+
* Read the final `maxBytes` of `eventsPath` and extract, in one forward pass,
|
|
6048
|
+
* every `user-prompt` (with its `ts`) and the last non-empty assistant text
|
|
6049
|
+
* run. The window's first line is usually torn; JSON.parse rejects it and it
|
|
6050
|
+
* is skipped. Never reads the whole file.
|
|
6051
|
+
*/
|
|
6052
|
+
declare function readTranscriptTail(eventsPath: string, maxBytes?: number): TranscriptTail;
|
|
6053
|
+
/** Recover a partial sidecar entry for a session from its `events.jsonl`
|
|
6054
|
+
* alone — the backfill path for a missing/corrupt index. Returns undefined
|
|
6055
|
+
* when the session dir has no transcript. */
|
|
6056
|
+
declare function deriveIndexFromTranscript(sessionId: string, baseDir?: string): SessionIndexEntry | undefined;
|
|
6057
|
+
/** Every sidecar under `baseDir`, newest activity first. Dirs with a missing
|
|
6058
|
+
* or corrupt index are recovered in memory from their transcript tail so a
|
|
6059
|
+
* find still sees them; this never writes. Best-effort: a readdir failure
|
|
6060
|
+
* returns `[]`. */
|
|
6061
|
+
declare function readAllSessionIndexes(baseDir?: string): SessionIndexEntry[];
|
|
6062
|
+
/** Case-insensitive query match: `id` by prefix, every other searchable field
|
|
6063
|
+
* by substring. An empty query matches everything. */
|
|
6064
|
+
declare function matchesSessionQuery(entry: Pick<SessionIndexEntry, "id" | "label" | "title" | "cwd" | "workspaceSlug">, query: string): boolean;
|
|
6065
|
+
/** Filter + order + cap a set of index entries. `limit` defaults to
|
|
6066
|
+
* {@link INDEX_DEFAULT_LIMIT}. */
|
|
6067
|
+
declare function searchSessionIndexes(entries: readonly SessionIndexEntry[], query: string, opts?: {
|
|
6068
|
+
status?: string;
|
|
6069
|
+
limit?: number;
|
|
6070
|
+
}): SessionIndexEntry[];
|
|
6071
|
+
/** The one-glance "where did we stop" recap — the output an agent needs to
|
|
6072
|
+
* resume. Built from the sidecar plus a bounded tail read of the transcript. */
|
|
6073
|
+
interface SessionRecap {
|
|
6074
|
+
id: string;
|
|
6075
|
+
status: string;
|
|
6076
|
+
alive: boolean;
|
|
6077
|
+
label?: string;
|
|
6078
|
+
title?: string;
|
|
6079
|
+
adapter?: string;
|
|
6080
|
+
model?: string;
|
|
6081
|
+
cwd?: string;
|
|
6082
|
+
workspaceSlug?: string;
|
|
6083
|
+
parentSessionId?: string;
|
|
6084
|
+
children: string[];
|
|
6085
|
+
startedAt: string;
|
|
6086
|
+
lastActivityAt?: string;
|
|
6087
|
+
turnsCompleted?: number;
|
|
6088
|
+
costUsd?: number;
|
|
6089
|
+
lastTurnReason?: string;
|
|
6090
|
+
/** Last K user prompts, oldest → newest. */
|
|
6091
|
+
prompts: TranscriptPrompt[];
|
|
6092
|
+
/** Final assistant text/thought of the last turn (trimmed). */
|
|
6093
|
+
lastOutputText?: string;
|
|
6094
|
+
queuedPrompts?: number;
|
|
6095
|
+
}
|
|
6096
|
+
/**
|
|
6097
|
+
* Compose a recap from an index entry + a bounded transcript tail read.
|
|
6098
|
+
* `eventsPath` is read from the end only (≤{@link INDEX_TAIL_BYTES});
|
|
6099
|
+
* `children`/`queuedPrompts` come from the caller (the daemon has them live,
|
|
6100
|
+
* the CLI derives children from the index set).
|
|
6101
|
+
*/
|
|
6102
|
+
declare function buildSessionRecap(input: {
|
|
6103
|
+
entry: SessionIndexEntry;
|
|
6104
|
+
eventsPath: string;
|
|
6105
|
+
last?: number;
|
|
6106
|
+
children?: readonly string[];
|
|
6107
|
+
queuedPrompts?: number;
|
|
6108
|
+
}): SessionRecap;
|
|
6109
|
+
/**
|
|
6110
|
+
* Daemon-startup pass: create the sidecar for every session dir that lacks a
|
|
6111
|
+
* valid one, recovering `lastUserPrompt`/`lastOutputText` from the transcript
|
|
6112
|
+
* tail (never a whole-file parse). When `descriptors` are supplied (the live
|
|
6113
|
+
* registry), their authoritative meta fills the entry. Best-effort and
|
|
6114
|
+
* synchronous — a store with thousands of sessions does one readdir plus one
|
|
6115
|
+
* bounded read per missing index, nothing more.
|
|
6116
|
+
*/
|
|
6117
|
+
declare function backfillSessionIndexes(baseDir?: string, opts?: {
|
|
6118
|
+
descriptors?: Iterable<SessionDescriptor>;
|
|
6119
|
+
}): {
|
|
6120
|
+
scanned: number;
|
|
6121
|
+
created: number;
|
|
6122
|
+
skipped: number;
|
|
6123
|
+
};
|
|
6124
|
+
|
|
5706
6125
|
/**
|
|
5707
6126
|
* Host-level load report - answers "why is this machine on its knees" without
|
|
5708
6127
|
* a hand-run `top` / `vm_stat` / `iostat` / `ps` / `lsof` session.
|
|
@@ -6066,9 +6485,15 @@ declare function runIdleReapPass(opts: {
|
|
|
6066
6485
|
* `status:"running"` until the next prompt's RPC fails. A parked session
|
|
6067
6486
|
* with no next prompt never gets that chance; the crash is silent forever.
|
|
6068
6487
|
*
|
|
6069
|
-
*
|
|
6070
|
-
*
|
|
6071
|
-
*
|
|
6488
|
+
* The same is true one layer up, for a reason a pid probe can never catch:
|
|
6489
|
+
* an ACP wrapper's PROCESS can outlive its own JSON-RPC stream. The stream
|
|
6490
|
+
* ends, `process.kill(pid, 0)` keeps succeeding, and the row reports
|
|
6491
|
+
* `running`/`alive: true` while every prompt rejects "ACP connection
|
|
6492
|
+
* closed". So this pass probes BOTH axes — process liveness AND transport
|
|
6493
|
+
* liveness (`adapterConnected`, from the live session's `isConnected()`).
|
|
6494
|
+
*
|
|
6495
|
+
* This pass sweeps the registry, finds agent-cli sessions provably dead on
|
|
6496
|
+
* either axis, and MARKS them crashed (`registry.markCrashed`): flips the row to
|
|
6072
6497
|
* `error`/`endedReason:"crashed"`, records a short `lastError`, and clears
|
|
6073
6498
|
* the dead binding so the row stays lazy-resumable — same shape as
|
|
6074
6499
|
* idle-reaper's `reapIdle`, except this pass is DISCOVERING a death that
|
|
@@ -6111,7 +6536,7 @@ interface CrashReaperRegistry {
|
|
|
6111
6536
|
list(opts?: {
|
|
6112
6537
|
includeArchived?: boolean;
|
|
6113
6538
|
}): readonly SessionDescriptor[];
|
|
6114
|
-
markCrashed(id: string): boolean;
|
|
6539
|
+
markCrashed(id: string, reason?: SessionCrashReason): boolean;
|
|
6115
6540
|
}
|
|
6116
6541
|
/**
|
|
6117
6542
|
* Run one crash-detect sweep. Pure over the registry's own freshly-probed
|
|
@@ -6511,54 +6936,6 @@ interface SentinelView {
|
|
|
6511
6936
|
lastError?: string;
|
|
6512
6937
|
}
|
|
6513
6938
|
|
|
6514
|
-
/**
|
|
6515
|
-
* Standard Webhooks `whsec_` signing for webhook egress (W-A of
|
|
6516
|
-
* `.plans/sentinel-mcp-events/PLAN.md`).
|
|
6517
|
-
*
|
|
6518
|
-
* Contract (frozen §3):
|
|
6519
|
-
* - HMAC-SHA256 over `msgId.timestamp.body` (raw bytes; `.update` chained so
|
|
6520
|
-
* the body is never re-encoded — payload arrives as `Uint8Array`, I2).
|
|
6521
|
-
* - Signature print = standard base64 (NOT base64url): `v1,<b64>`.
|
|
6522
|
-
* - HMAC key = the base64 payload DECODED after the `whsec_` prefix.
|
|
6523
|
-
* - Multi-secret: space-separated `v1,<sig>` segments (rotation window).
|
|
6524
|
-
* - Returns ONLY headers — the caller owns the bytes and signs them again
|
|
6525
|
-
* with a fresh timestamp on retry; signing never re-serializes.
|
|
6526
|
-
*/
|
|
6527
|
-
interface WebhookSignInput {
|
|
6528
|
-
/** Stable event id (`evt_…` / verification `msg_verification_…`) — same across retries. */
|
|
6529
|
-
msgId: string;
|
|
6530
|
-
/** Seconds, Unix epoch (Standard Webhooks wire format). */
|
|
6531
|
-
timestamp: number;
|
|
6532
|
-
/** Exact bytes — signed once (I2). Caller passes the serialization; signing never re-serializes. */
|
|
6533
|
-
payload: Uint8Array;
|
|
6534
|
-
/** One or, during a rotation window, two secrets (`whsec_…`). */
|
|
6535
|
-
secrets: readonly string[];
|
|
6536
|
-
}
|
|
6537
|
-
type WebhookSignatureHeaders = {
|
|
6538
|
-
"webhook-id": string;
|
|
6539
|
-
"webhook-timestamp": string;
|
|
6540
|
-
"webhook-signature": string;
|
|
6541
|
-
};
|
|
6542
|
-
/**
|
|
6543
|
-
* Encode raw secret bytes into the `whsec_<base64>` wire format.
|
|
6544
|
-
* Inverse of {@link decodeWhsecSecret}.
|
|
6545
|
-
*/
|
|
6546
|
-
declare function encodeWhsecSecret(raw: Uint8Array): string;
|
|
6547
|
-
/**
|
|
6548
|
-
* Decode a `whsec_…` secret to its raw HMAC key: standard-base64 payload
|
|
6549
|
-
* after the prefix, which must decode to 24..64 bytes. Returns `null` on any
|
|
6550
|
-
* violation (bad prefix, not base64, length out of range). The canonical
|
|
6551
|
-
* validator for W-C: a submit failing this is `-32602` upstream; egress
|
|
6552
|
-
* surfaces it as a categorized challenge failure.
|
|
6553
|
-
*/
|
|
6554
|
-
declare function decodeWhsecSecret(secret: string): Buffer | null;
|
|
6555
|
-
/**
|
|
6556
|
-
* Sign exactly the bytes given. Throws `Error` when any secret fails
|
|
6557
|
-
* {@link decodeWhsecSecret} (callers must have validated upstream; a bad
|
|
6558
|
-
* secret at this point is a programmer error, never silently signed).
|
|
6559
|
-
*/
|
|
6560
|
-
declare function signWebhook(input: WebhookSignInput): WebhookSignatureHeaders;
|
|
6561
|
-
|
|
6562
6939
|
/**
|
|
6563
6940
|
* SSRF-guarded outbound HTTPS POST for webhook egress (W-A of
|
|
6564
6941
|
* `.plans/sentinel-mcp-events/PLAN.md`).
|
|
@@ -6767,6 +7144,316 @@ declare function envelopeClampedBytes(event: McpEventEnvelope): {
|
|
|
6767
7144
|
};
|
|
6768
7145
|
declare function deliverEventEnvelope(replay: DeliveryReplay, event: McpEventEnvelope, deps?: DeliverEventDeps): Promise<DeliveryOutcome>;
|
|
6769
7146
|
|
|
7147
|
+
/**
|
|
7148
|
+
* MCP Events registry (W-C of `.plans/sentinel-mcp-events/PLAN.md`, §2/§3).
|
|
7149
|
+
*
|
|
7150
|
+
* One object per provider scheme. Every registration carries the WIRE
|
|
7151
|
+
* `EventDefinition` (name / description / `delivery:["webhook"]` /
|
|
7152
|
+
* `inputSchema` / `payloadSchema` — official doc verbatim, no extra fields)
|
|
7153
|
+
* PLUS the internal `InternalEventMeta`. Two fields on the meta are
|
|
7154
|
+
* MANDATORY by type: `argumentsToMatch` (the missing link between
|
|
7155
|
+
* `document_id`-style subscription args and `SentinelSpec.match`) and
|
|
7156
|
+
* `authorize`. A registration that omits either does not compile.
|
|
7157
|
+
*
|
|
7158
|
+
* `replayable` is INTERNAL only (it drives `cursor:null` for v1) and must
|
|
7159
|
+
* never appear on the wire — the §3 `EventDefinition` has no such field.
|
|
7160
|
+
*
|
|
7161
|
+
* Day-1 scheme: `github`. The definitions are derived from the ACTUAL event
|
|
7162
|
+
* types the providers declare/emit in `sentinel-providers/` (verified with
|
|
7163
|
+
* `rg 'github\.' packages/runtime/src/sentinel-providers`) — NOT from the
|
|
7164
|
+
* illustrative names in the plan's task text. See `GITHUB_SCHEME` below.
|
|
7165
|
+
*/
|
|
7166
|
+
|
|
7167
|
+
declare const PRINCIPAL_BRAND: unique symbol;
|
|
7168
|
+
/**
|
|
7169
|
+
* The authenticated caller of a native MCP `events/*` call. REALITY (plan
|
|
7170
|
+
* §1): the root `/mcp` transport authenticates with ONE daemon bearer (or
|
|
7171
|
+
* trusted loopback) and exposes only an optional `callerSessionId` — there is
|
|
7172
|
+
* no per-caller auth-profile principal yet. So v1 has exactly two
|
|
7173
|
+
* constructors; a future W-F multi-tenant widening touches this one file.
|
|
7174
|
+
*/
|
|
7175
|
+
type Principal = string & {
|
|
7176
|
+
readonly [PRINCIPAL_BRAND]: true;
|
|
7177
|
+
};
|
|
7178
|
+
declare function daemonBearerPrincipal(): Principal;
|
|
7179
|
+
declare function sessionPrincipal(sessionId: string): Principal;
|
|
7180
|
+
interface EventDefinition {
|
|
7181
|
+
name: string;
|
|
7182
|
+
description: string;
|
|
7183
|
+
delivery: ["webhook"];
|
|
7184
|
+
inputSchema: object;
|
|
7185
|
+
payloadSchema: object;
|
|
7186
|
+
}
|
|
7187
|
+
/** What `argumentsToMatch` produces: explicit Sentinel match clauses plus the
|
|
7188
|
+
* provider slug that can emit the event. `ok:false` becomes `-32602` with a
|
|
7189
|
+
* definition-specific reason. */
|
|
7190
|
+
type ArgumentsResult = {
|
|
7191
|
+
ok: true;
|
|
7192
|
+
matchClauses: SentinelMatchClause[];
|
|
7193
|
+
providerSlug: string;
|
|
7194
|
+
} | {
|
|
7195
|
+
ok: false;
|
|
7196
|
+
reason: string;
|
|
7197
|
+
};
|
|
7198
|
+
interface InternalEventMeta {
|
|
7199
|
+
/** INTERNAL: drives `cursor:null` vs a provider cursor. v1 is all-false. */
|
|
7200
|
+
replayable: boolean;
|
|
7201
|
+
/** Map `inputSchema`-validated args to explicit match clauses (pure). */
|
|
7202
|
+
argumentsToMatch: (args: Record<string, unknown>) => ArgumentsResult;
|
|
7203
|
+
/** Authorization gate for the given principal. */
|
|
7204
|
+
authorize: (args: Record<string, unknown>, principal: Principal) => boolean;
|
|
7205
|
+
}
|
|
7206
|
+
interface EventRegistration {
|
|
7207
|
+
definition: EventDefinition;
|
|
7208
|
+
meta: InternalEventMeta;
|
|
7209
|
+
}
|
|
7210
|
+
interface SchemeRegistry {
|
|
7211
|
+
scheme: string;
|
|
7212
|
+
events: EventRegistration[];
|
|
7213
|
+
}
|
|
7214
|
+
/** Validate subscription args against a definition's `inputSchema`. */
|
|
7215
|
+
declare function validateAgainstInputSchema(schema: object, args: unknown): {
|
|
7216
|
+
ok: true;
|
|
7217
|
+
} | {
|
|
7218
|
+
ok: false;
|
|
7219
|
+
reason: string;
|
|
7220
|
+
};
|
|
7221
|
+
/**
|
|
7222
|
+
* The day-1 github scheme. Types are the ACTUAL `github.*` strings emitted by
|
|
7223
|
+
* `sentinel-providers/local-gh.ts` (the zero-infra provider the plan names):
|
|
7224
|
+
* - github.pull_request.closed
|
|
7225
|
+
* - github.pull_request.synchronize
|
|
7226
|
+
* - github.pull_request_review.submitted
|
|
7227
|
+
* - github.check_suite.completed
|
|
7228
|
+
*
|
|
7229
|
+
* The plan's illustrative `github.pull_request.opened` and
|
|
7230
|
+
* `github.build.failed` do NOT exist in `sentinel-providers/` (opened is only
|
|
7231
|
+
* producible by the push `webhook` provider's normalizer; build.failed exists
|
|
7232
|
+
* nowhere — the closest real signal is `github.check_suite.completed` with
|
|
7233
|
+
* `data.conclusion === "failure"`). Per the plan's own instruction to surface
|
|
7234
|
+
* actual declared values, only real types ship — no fabricated definition.
|
|
7235
|
+
*
|
|
7236
|
+
* `local-gh`'s `defaultTypes()` also lists `github.workflow_run.completed` and
|
|
7237
|
+
* `github.issue_comment.created`, but its poll implementation does not emit
|
|
7238
|
+
* them (documented in `local-gh.ts`); shipping them here would advertise
|
|
7239
|
+
* subscriptions that can never fire, so they are intentionally omitted.
|
|
7240
|
+
*/
|
|
7241
|
+
declare const GITHUB_SCHEME: SchemeRegistry;
|
|
7242
|
+
/** Every registered scheme. Adding a scheme = one object + one test row. */
|
|
7243
|
+
declare const EVENT_REGISTRY: readonly SchemeRegistry[];
|
|
7244
|
+
/** The schemes a principal may discover/subscribe to. v1: single tenant, all. */
|
|
7245
|
+
declare function tenantScope(_principal: Principal): readonly SchemeRegistry[];
|
|
7246
|
+
/** Look up a registration by official wire name (all schemes). */
|
|
7247
|
+
declare function findEventDefinition(name: string): EventRegistration | undefined;
|
|
7248
|
+
|
|
7249
|
+
/**
|
|
7250
|
+
* MCP Events adapter (W-C of `.plans/sentinel-mcp-events/PLAN.md`, §2/§3).
|
|
7251
|
+
*
|
|
7252
|
+
* Three methods over the existing Sentinel core — `events/list`,
|
|
7253
|
+
* `events/subscribe`, `events/unsubscribe`. This module owns the subscription
|
|
7254
|
+
* lifecycle; the transport (native JSON-RPC methods + `events:{}` in
|
|
7255
|
+
* `server/discover`) lives in `@agentproto/mcp-server` and is wired in
|
|
7256
|
+
* `runtime/index.ts`.
|
|
7257
|
+
*
|
|
7258
|
+
* INVARIANTS v1 (plan §2, code-verified):
|
|
7259
|
+
* - every event is NON-REPLAYABLE → `cursor` is always `null`, `truncated`
|
|
7260
|
+
* is never set;
|
|
7261
|
+
* - no `read` tool, no separate package, no batching.
|
|
7262
|
+
*
|
|
7263
|
+
* Subscription ids are deterministic (`subscription-id.ts`): subscribe upserts
|
|
7264
|
+
* on identity, unsubscribe RECOMPUTES the id (never an id-lookup). The store
|
|
7265
|
+
* has no CAS and `create()` silently overwrites, so every mutation is
|
|
7266
|
+
* serialized behind an in-process async mutex.
|
|
7267
|
+
*/
|
|
7268
|
+
|
|
7269
|
+
declare const DEFAULT_TTL_MS: number;
|
|
7270
|
+
declare const MAX_TTL_MS: number;
|
|
7271
|
+
/** Store minimum lifetime — prevents churn-refresh for a tiny requested TTL. */
|
|
7272
|
+
declare const MIN_TTL_MS: number;
|
|
7273
|
+
/**
|
|
7274
|
+
* `refreshBefore` is the GRANTED EXPIRATION itself (`until.ms` as ISO-8601),
|
|
7275
|
+
* per the official doc — never a pre-expiry hint. `until:{kind:"never"}`
|
|
7276
|
+
* (only granted for `ttlMs: null`) yields `null`.
|
|
7277
|
+
*/
|
|
7278
|
+
declare function computeRefreshBefore(until: SentinelUntil): string | null;
|
|
7279
|
+
/**
|
|
7280
|
+
* `ttlMs` mapping (§2):
|
|
7281
|
+
* omitted → default 7d;
|
|
7282
|
+
* number → grant `min(requested, 30d)`, floored at 60s;
|
|
7283
|
+
* null → `until:{kind:"never"}` (no expiration).
|
|
7284
|
+
*/
|
|
7285
|
+
declare function untilForTtl(ttlMs: number | null | undefined, now: number): SentinelUntil;
|
|
7286
|
+
/**
|
|
7287
|
+
* An error the native-method transport surfaces verbatim as a JSON-RPC error:
|
|
7288
|
+
* the SDK's request path copies `code` and `data` straight onto the error
|
|
7289
|
+
* response, so no transport-side catch is needed.
|
|
7290
|
+
*/
|
|
7291
|
+
declare class McpEventsError extends Error {
|
|
7292
|
+
readonly code: number;
|
|
7293
|
+
readonly data?: Record<string, unknown>;
|
|
7294
|
+
constructor(code: number, message: string, data?: Record<string, unknown>);
|
|
7295
|
+
}
|
|
7296
|
+
interface EventsListRequest {
|
|
7297
|
+
cursor?: string;
|
|
7298
|
+
pageSize?: number;
|
|
7299
|
+
}
|
|
7300
|
+
interface EventsListContext {
|
|
7301
|
+
principal: Principal;
|
|
7302
|
+
}
|
|
7303
|
+
interface EventsListResult {
|
|
7304
|
+
events: EventDefinition[];
|
|
7305
|
+
nextCursor: string | null;
|
|
7306
|
+
}
|
|
7307
|
+
interface EventsSubscribeInput {
|
|
7308
|
+
name: string;
|
|
7309
|
+
arguments: Record<string, unknown>;
|
|
7310
|
+
delivery: {
|
|
7311
|
+
mode: "webhook";
|
|
7312
|
+
url: string;
|
|
7313
|
+
secret: string;
|
|
7314
|
+
};
|
|
7315
|
+
ttlMs?: number | null;
|
|
7316
|
+
/** Refresh/replay handle (null on first subscribe). v1 ignores it: all
|
|
7317
|
+
* events are non-replayable, so it never changes the returned cursor. */
|
|
7318
|
+
cursor?: string | null;
|
|
7319
|
+
}
|
|
7320
|
+
interface EventsSubscribeContext {
|
|
7321
|
+
principal: Principal;
|
|
7322
|
+
store: SentinelStore;
|
|
7323
|
+
resolveProvider: (slug: string) => Promise<SentinelProviderHandle | null>;
|
|
7324
|
+
nowMs?: () => number;
|
|
7325
|
+
/** DI seam (tests): replaces `verifyCallback`'s POST boundary. */
|
|
7326
|
+
verify?: typeof verifyCallback;
|
|
7327
|
+
activeIntervalMs?: number;
|
|
7328
|
+
}
|
|
7329
|
+
interface EventsSubscribeResult {
|
|
7330
|
+
id: `sub_${string}`;
|
|
7331
|
+
refreshBefore: string | null;
|
|
7332
|
+
cursor: string | null;
|
|
7333
|
+
truncated?: boolean;
|
|
7334
|
+
}
|
|
7335
|
+
interface EventsUnsubscribeInput {
|
|
7336
|
+
name: string;
|
|
7337
|
+
arguments: Record<string, unknown>;
|
|
7338
|
+
delivery: {
|
|
7339
|
+
mode: "webhook";
|
|
7340
|
+
url: string;
|
|
7341
|
+
};
|
|
7342
|
+
}
|
|
7343
|
+
interface EventsUnsubscribeContext {
|
|
7344
|
+
principal: Principal;
|
|
7345
|
+
store: SentinelStore;
|
|
7346
|
+
resolveProvider: (slug: string) => Promise<SentinelProviderHandle | null>;
|
|
7347
|
+
}
|
|
7348
|
+
declare function eventsList(r: EventsListRequest, ctx: EventsListContext): Promise<EventsListResult>;
|
|
7349
|
+
declare function eventsSubscribe(input: EventsSubscribeInput, ctx: EventsSubscribeContext): Promise<EventsSubscribeResult>;
|
|
7350
|
+
declare function eventsUnsubscribe(input: EventsUnsubscribeInput, ctx: EventsUnsubscribeContext): Promise<{}>;
|
|
7351
|
+
/**
|
|
7352
|
+
* CloudEvents `SentinelEvent` → the MCP Events wire envelope (official doc
|
|
7353
|
+
* verbatim): `id→eventId`, `type→name`, `time→timestamp`, `data→data` (plus
|
|
7354
|
+
* the `subject`/`summary` projection so the 256 KiB clamp's `{summary,
|
|
7355
|
+
* subject}` replacement never goes blind), and `cursor: null` (v1
|
|
7356
|
+
* non-replayable). No top-level `type` — that field is reserved for protocol
|
|
7357
|
+
* control notifications we never send.
|
|
7358
|
+
*/
|
|
7359
|
+
declare function toMcpEvent(event: SentinelEvent): McpEventEnvelope;
|
|
7360
|
+
|
|
7361
|
+
/**
|
|
7362
|
+
* Deterministic MCP Events subscription ids (W-C of
|
|
7363
|
+
* `.plans/sentinel-mcp-events/PLAN.md`, §3 frozen).
|
|
7364
|
+
*
|
|
7365
|
+
* The id is a pure function of the subscription IDENTITY — authenticated
|
|
7366
|
+
* principal + normalized callback URL + event name + subscription arguments —
|
|
7367
|
+
* so the SAME logical subscription always lands on the SAME id. That is what
|
|
7368
|
+
* makes `events/subscribe` idempotent (upsert, never duplicate) and lets
|
|
7369
|
+
* `events/unsubscribe` recompute the id instead of trusting a caller-supplied
|
|
7370
|
+
* one.
|
|
7371
|
+
*
|
|
7372
|
+
* Hashing input is RFC 8785 (JCS) canonical JSON: recursive key sort by
|
|
7373
|
+
* UTF-16 code units, ECMAScript number serialization, Unicode minimization
|
|
7374
|
+
* (literal non-ASCII, control chars escaped). The `args` payload is trustless
|
|
7375
|
+
* input and nested objects are legal, so a plain `JSON.stringify` (key order
|
|
7376
|
+
* dependent) would let `{a:1,b:2}` and `{b:2,a:1}` mint two different
|
|
7377
|
+
* subscriptions for one logical watch — exactly the duplicate the doc warns
|
|
7378
|
+
* against. The canonical form is a single source of truth shared by subscribe
|
|
7379
|
+
* and unsubscribe.
|
|
7380
|
+
*/
|
|
7381
|
+
interface SubscriptionIdentity {
|
|
7382
|
+
/** Authenticated principal (`daemon-bearer` or `session:<id>`). */
|
|
7383
|
+
principal: string;
|
|
7384
|
+
/** Callback URL exactly as submitted (identity component; no normalization
|
|
7385
|
+
* beyond what the caller already applied — challenge caching normalizes
|
|
7386
|
+
* separately). */
|
|
7387
|
+
callbackUrl: string;
|
|
7388
|
+
/** Official wire event name, e.g. `github.pull_request.closed`. */
|
|
7389
|
+
eventName: string;
|
|
7390
|
+
/** Subscription arguments (JSON, nested objects legal). */
|
|
7391
|
+
args: Record<string, unknown>;
|
|
7392
|
+
}
|
|
7393
|
+
/**
|
|
7394
|
+
* RFC 8785 (JCS) canonical JSON over a JSON-legal value. Throws on values
|
|
7395
|
+
* JSON cannot carry (`undefined`, functions, non-finite numbers) rather than
|
|
7396
|
+
* silently coercing them — a trustless `args` payload must fail loudly, not
|
|
7397
|
+
* hash to a phantom identity.
|
|
7398
|
+
*
|
|
7399
|
+
* `JSON.stringify` already implements the JCS string and number rules for
|
|
7400
|
+
* well-formed JSON: ECMAScript shortest-round-trip number printing (`-0` →
|
|
7401
|
+
* `"0"`), control-char escaping, literal non-ASCII (Unicode minimization),
|
|
7402
|
+
* and `\uXXXX` for lone surrogates (ES2019 well-formed stringify). Only the
|
|
7403
|
+
* recursive object-key sort is added here.
|
|
7404
|
+
*/
|
|
7405
|
+
declare function canonicalizeJcs(value: unknown): string;
|
|
7406
|
+
/** `sub_<hex32>` — sha256 over the JCS canonical identity, first 128 bits. */
|
|
7407
|
+
declare function subscriptionId(identity: SubscriptionIdentity): `sub_${string}`;
|
|
7408
|
+
|
|
7409
|
+
/**
|
|
7410
|
+
* Standard Webhooks `whsec_` signing for webhook egress (W-A of
|
|
7411
|
+
* `.plans/sentinel-mcp-events/PLAN.md`).
|
|
7412
|
+
*
|
|
7413
|
+
* Contract (frozen §3):
|
|
7414
|
+
* - HMAC-SHA256 over `msgId.timestamp.body` (raw bytes; `.update` chained so
|
|
7415
|
+
* the body is never re-encoded — payload arrives as `Uint8Array`, I2).
|
|
7416
|
+
* - Signature print = standard base64 (NOT base64url): `v1,<b64>`.
|
|
7417
|
+
* - HMAC key = the base64 payload DECODED after the `whsec_` prefix.
|
|
7418
|
+
* - Multi-secret: space-separated `v1,<sig>` segments (rotation window).
|
|
7419
|
+
* - Returns ONLY headers — the caller owns the bytes and signs them again
|
|
7420
|
+
* with a fresh timestamp on retry; signing never re-serializes.
|
|
7421
|
+
*/
|
|
7422
|
+
interface WebhookSignInput {
|
|
7423
|
+
/** Stable event id (`evt_…` / verification `msg_verification_…`) — same across retries. */
|
|
7424
|
+
msgId: string;
|
|
7425
|
+
/** Seconds, Unix epoch (Standard Webhooks wire format). */
|
|
7426
|
+
timestamp: number;
|
|
7427
|
+
/** Exact bytes — signed once (I2). Caller passes the serialization; signing never re-serializes. */
|
|
7428
|
+
payload: Uint8Array;
|
|
7429
|
+
/** One or, during a rotation window, two secrets (`whsec_…`). */
|
|
7430
|
+
secrets: readonly string[];
|
|
7431
|
+
}
|
|
7432
|
+
type WebhookSignatureHeaders = {
|
|
7433
|
+
"webhook-id": string;
|
|
7434
|
+
"webhook-timestamp": string;
|
|
7435
|
+
"webhook-signature": string;
|
|
7436
|
+
};
|
|
7437
|
+
/**
|
|
7438
|
+
* Encode raw secret bytes into the `whsec_<base64>` wire format.
|
|
7439
|
+
* Inverse of {@link decodeWhsecSecret}.
|
|
7440
|
+
*/
|
|
7441
|
+
declare function encodeWhsecSecret(raw: Uint8Array): string;
|
|
7442
|
+
/**
|
|
7443
|
+
* Decode a `whsec_…` secret to its raw HMAC key: standard-base64 payload
|
|
7444
|
+
* after the prefix, which must decode to 24..64 bytes. Returns `null` on any
|
|
7445
|
+
* violation (bad prefix, not base64, length out of range). The canonical
|
|
7446
|
+
* validator for W-C: a submit failing this is `-32602` upstream; egress
|
|
7447
|
+
* surfaces it as a categorized challenge failure.
|
|
7448
|
+
*/
|
|
7449
|
+
declare function decodeWhsecSecret(secret: string): Buffer | null;
|
|
7450
|
+
/**
|
|
7451
|
+
* Sign exactly the bytes given. Throws `Error` when any secret fails
|
|
7452
|
+
* {@link decodeWhsecSecret} (callers must have validated upstream; a bad
|
|
7453
|
+
* secret at this point is a programmer error, never silently signed).
|
|
7454
|
+
*/
|
|
7455
|
+
declare function signWebhook(input: WebhookSignInput): WebhookSignatureHeaders;
|
|
7456
|
+
|
|
6770
7457
|
/**
|
|
6771
7458
|
* SentinelWebhookOutbox — the PERSISTED outbox for `webhook`-target sentinel
|
|
6772
7459
|
* events (W-B of `.plans/sentinel-mcp-events/PLAN.md`, §4 task 3).
|
|
@@ -6887,11 +7574,12 @@ interface SentinelWebhookOutboxOptions {
|
|
|
6887
7574
|
}
|
|
6888
7575
|
/** `sub_<hex32>` — deterministic over (sentinelId, eventId). */
|
|
6889
7576
|
declare function webhookRequestId(sentinelId: string, eventId: string): `sub_${string}`;
|
|
6890
|
-
/** The CloudEvents → MCP-Events-envelope fusion
|
|
6891
|
-
*
|
|
6892
|
-
*
|
|
6893
|
-
*
|
|
6894
|
-
*
|
|
7577
|
+
/** The CloudEvents → MCP-Events-envelope fusion. W-C's `mcp-events/adapter.ts`
|
|
7578
|
+
* is now the canonical owner of this mapping (`toMcpEvent`); this alias keeps
|
|
7579
|
+
* the W-B call sites/tests working. The shape is the frozen §3 wire envelope —
|
|
7580
|
+
* insertion order stable, so its serialization is byte-stable across
|
|
7581
|
+
* restarts. `data` gains `subject`/`summary` so the 256 KiB clamp's
|
|
7582
|
+
* `{summary, subject}` replacement never goes blind. */
|
|
6895
7583
|
declare function toWebhookEnvelope(event: SentinelEvent): McpEventEnvelope;
|
|
6896
7584
|
declare function createSentinelWebhookOutbox(opts: SentinelWebhookOutboxOptions): SentinelWebhookOutbox;
|
|
6897
7585
|
|
|
@@ -8653,6 +9341,19 @@ interface GatewayHandle {
|
|
|
8653
9341
|
continueInterruptedOnBoot(opts?: {
|
|
8654
9342
|
isServed?: (desc: SessionDescriptor) => boolean;
|
|
8655
9343
|
}): Promise<ContinueOnBootSummary>;
|
|
9344
|
+
/** Daemon-startup backfill for the per-session index sidecars
|
|
9345
|
+
* (`session-index.ts`): create a compact `index.json` for every session dir
|
|
9346
|
+
* that lacks one, recovering the last prompt/output from the transcript
|
|
9347
|
+
* tail (never a whole-file parse). Synchronous and best-effort — a store
|
|
9348
|
+
* with thousands of sessions pays one readdir plus one bounded read per
|
|
9349
|
+
* missing index. serve.ts calls this once at boot so `agentproto sessions
|
|
9350
|
+
* find`/`recap` answer instantly even for sessions that predate the
|
|
9351
|
+
* sidecar. */
|
|
9352
|
+
backfillSessionIndexes(): {
|
|
9353
|
+
scanned: number;
|
|
9354
|
+
created: number;
|
|
9355
|
+
skipped: number;
|
|
9356
|
+
};
|
|
8656
9357
|
stop(): Promise<void>;
|
|
8657
9358
|
}
|
|
8658
9359
|
/**
|
|
@@ -8669,4 +9370,4 @@ interface GatewayHandle {
|
|
|
8669
9370
|
*/
|
|
8670
9371
|
declare function createGateway(opts: CreateGatewayOptions): Promise<GatewayHandle>;
|
|
8671
9372
|
|
|
8672
|
-
export { ActivityListFilter, type ActivityPolicyLister, type ActivityProjector, type ActivityProjectorRegistry, type ActivityProjectorSession, ActivityRecord, type ActivityWorkflowLister, AdapterAuthDescriptor, type AdapterCapabilitiesLister, type AdapterInstallResult, type AdapterListEntry, type AgentAdapterInstaller, type AgentAdapterLister, type AgentAdapterResolver, AgentSessionLike, AgentStreamEvent, type AttachSandboxOpts, type AttachSandboxResult, BUCKETS_ROOT, type BranchGcClass, type BranchGcCoverageView, type BranchGcHoldReason, type BranchGcKind, type BranchGcOutcomeView, type BranchGcPlanEntryView, type BranchGcPlanView, type BranchGcReclaimReason, type BranchGcResult, type BranchGcRunInput, type BranchGcRunner, type BranchGcStatus, type BranchGcSummaryView, type BranchGcTriageVerdict, type BranchGcVerdictInput, type BranchGcVerdictLookupInput, type BranchGcVerdictReader, type BranchGcVerdictRecordView, type BranchGcVerdictRecorder, type BrowserAdapterHandle, type BrowserAdapterInfo, type BrowserAdapterLister, type BrowserAdapterResolver, BuildHeartbeatAgent, CLAMP_LIMIT_BYTES, CONTINUE_PROMPT_SOURCE, CanonicalPosture, type CapabilitiesInventory, type CapabilitiesInventoryMcp, type CapabilitiesInventorySkills, type CatalogModelsLister, CatalogModelsQuery, CatalogModelsResponse, type CatalogProviderModel, type CatalogProviderModelsQuery, type CatalogProviderModelsResponse, type CatalogProviderPricing, type ChallengeFailureReason, type ChallengeOutcome, type ClaudeNativeRef, CompletionPolicySupervisor, type ComposeCandidate, ContextProfile, type ContinueInterruptedMode, type ContinueInterruptedOutcome, type ContinueInterruptedResult, type ContinueInterruptedSkipReason, type ContinueOnBootSummary, type ConversationIndexRecord, type ConversationNativeRef, type CostBudgetDecision, type CrashDetectSummary, type CrashReaperRegistry, type CreateGatewayOptions, type CreateJoinTokenInput, type CreateReviewRunnerOptions, type CreatedJoinToken, DEAD_SESSION_STATUSES, DEFAULT_ALWAYS_ON_TOOLS, DEFAULT_BUCKET, DEFAULT_CONTINUE_PROMPT, DEFAULT_HOST_LOAD_BUDGET_MS, DEFAULT_HOST_LOAD_THRESHOLDS, DEFAULT_ORCHESTRATOR_TOOLS, DEVICE_PROMPT_PATH_PREFIX, type DaemonReviewerHostDeps, DeclaredAdapterOption, type DeclaredAdapterPreset, DefaultsAdapterAuthConfig, type DeliveryOutcome, type DeliveryReplay, type DeliveryState, type Device, type DeviceKind, type DeviceMirrorSyncResult, type DeviceMirrorTarget, type DevicePromptSessionsLike, type DeviceRegistry, type DeviceRole, type DiskLoad, type EagerResumeSummary, type EgressDispatcher, type EnableInput, type EnableResult, type FetchHostTurnsResult, type FindComposeCandidateInput, type ForwardHttpRequest, type ForwardHttpResponse, GC_REAPABLE_STATES, type GatewayHandle, type GhRunner, HOSTS_VERSION, HOST_HANDSHAKE_REMEDIATION_HINT, HOST_SCOPE_HEADER, type HarnessPreset, type HarnessPresetValidationDeps, HarnessPresetValidationError, type HarnessPresetsFile, type HermesNativeRef, type HostEventRecord, type HostJoinMeta, type HostLoadCpu, type HostLoadDetail, type HostLoadMemory, type HostLoadReport, type HostLoadService, type HostLoadSwap, type HostLoadThresholds, type HostProbes, type HostProcess, type HostProcessOwner, type HostRecord, type HostRegistry, type HostRegistryDeps, type HostSessionRollup, type HostWarning, type HostWarningKind, INBOUND_PROVIDERS, type IdleReapSummary, type IdleReaperRegistry, type InboundEndpoint, type InboundEndpointStore, type InboundEndpointStoreOptions, type InboundEnqueuePrompt, type InboundIsSessionAlive, type InboundMessage, type InboundProvider, type InboundRestartSession, type InboundRouteMode, type InboundRouterDeps, type InboundRouterLog, type InboundSpawnForContact, type InboundWatcher, JOIN_TOKENS_VERSION, type JoinTokenRecord, type JoinTokenRegistry, type JoinTokenRegistryDeps, LEGACY_SESSIONS_FILE, type LedgerAnnotations, type LedgerEntry, type LedgerHostMeta, type LlmEndpointDescriptor, type LlmEndpointStatus, type LlmEndpointStatusReport, type LocatedConversation, type LocatedConversationByPath, MAX_ATTEMPTS, MAX_AUTO_CONTINUE_ATTEMPTS, MCP_APP_BRIDGE_SCRIPT, type McpCredentialDeps, type McpEventEnvelope, type MeasurableTool, type MeasuredToolEntry, MessageKind, MessageUrgency, type MigrationMarker, type ModelRolesInput, type ModelRolesOutput, type NormalizeInboundResult, type OpenPrResolver, type OrchestratorGatewayDeps, type OrchestratorInjection, type OrchestratorInjector, type OrchestratorInjectorDeps, type OrchestratorMcpServerFactory, type OrchestratorScope, type OrphanReaperRegistry, POSTURE_NATIVE_ALIASES, POSTURE_PREAMBLES, type PersistedOutboxRow, PolicyRunState, Posture, type PostureResolution, PrLookupError, type PrLookupErrorCode, PrResolvedState, type PrStateResolver, type PrStatusSnapshot, type PresetInfo, type ProjectBrowserToolsOptions, type ProjectedBrowserTool, type ProjectedBrowserTools, type ProjectedProvider, type ProjectedToolResult, type PromptHostSessionInput, type PromptHostSessionResult, ProvisionInFlight, QuotaReadableProfile, type RegisterBrainToolsOptions, type RegisterDeviceToolsOptions, type RegisterPairingToolsOptions, type RegisterReviewToolsOptions, type RegisterWebSearchToolsOptions, RemainingQuotaReader, type RemoteStatus, type ResolveNativeLinkInput, ResolvedAuthSpec, ResolvedModelRole, type ReuseResolution, type ReviewComposeContext, type ReviewLedger, type ReviewLedgerFilter, type ReviewRun, type ReviewRunInput, type ReviewRunStatus, type ReviewRunner, type ReviewSignature, type ReviewSigningKey, type ReviewerRunResult, type ReviewerSessionHost, type RouteAwareLaunchConfig, type RouteAwareLaunchConfigInput, RouteSpec, type RuntimeMeta, SIGN_NAMESPACE, type SandboxAdapterInfo, type SandboxConnectionDescriptor, type SandboxGcCandidate, type SandboxGcProviderHandle, type SandboxGcReapDeps, type SandboxGcReapResult, type SandboxLedgerEntry, type SandboxLedgerState, type SandboxProviderCapabilities, type SandboxProviderHandle, type SandboxProviderLister, type SandboxProviderResolver, type SandboxReconcileDeps, type SandboxReconcileProviderHandle, type SandboxReconcileResult, type SandboxReconcileRow, type SandboxReconcileVerdict, type ScopeTokenRegistry, type SentinelMatchClause, type SentinelSpec, type SentinelStatus, type SentinelTarget, type SentinelUntil, type SentinelView, type SentinelWebhookOutbox, type SentinelWebhookOutboxOptions, type SentinelWebhookOutboxRow, type SentinelWebhookOutboxStatus, SessionDescriptor, SessionEndReason, SessionMessage, type SessionMessageSentRecord, type SessionObserver, SessionUsage, type SessionUsageWithSubtree, type SessionWaitEvent, type SessionWaitResult, SessionsRegistry, type SkillPackInventoryEntry, type SkillsByHarnessEntry, SpawnDefaultsConfig, SsrfFetchError, type SsrfFetchInit, type SsrfFetchReason, type SsrfFetchResult, type StallWatchdogRegistry, type StallWatchdogSummary, type SubtreeChildUsage, type SubtreeUsageTotals, TaskLedger, type ToolListMeasurement, type TransmitterBinding, type TransmitterBindingStore, type TunnelDescriptor, type TunnelProvider, type TunnelStatus, UsageReadContext, UsageReadResult, UsageRollup, UsageSnapshotRecord, UserPreset, type VerifyCallbackInput, type VerifySignedAttestationResult, type WatcherDescriptor, type WatcherStartInput, type WebSearchInput, type WebSearchOutput, type WebSearchResult, type WebhookSignInput, type WebhookSignatureHeaders, type WorkspaceBrainSubscriber, type WorkspaceBrainSubscriberOptions, type WorkspaceBrains, WorkspaceFs, WorktreeAutoReclaimer, WorktreeField, type WorktreeGcClass, type WorktreeGcOutcomeView, type WorktreeGcPlanEntryView, type WorktreeGcReclaimReason, type WorktreeGcResult, type WorktreeGcRunInput, type WorktreeGcRunner, WorktreeIsolationMode, WorktreeProvisioner, type WorktreeStatusLister, type WorktreeStatusView, addHarnessPreset, allowedSignersLine, appendConversationRecord, attachSandbox, bucketDir, bucketSessionsFile, bucketTranscriptDir, buildCatalogProviderModels, buildHostLoadReport, buildMcpConfigSnippet, buildRouteAwareLaunchConfig, canonicalForModeId, challengeCacheSize, challengeReasonForSsrf, claudeProjectSlug, collectGcCandidates, collectHostSample, composeSessionObservers, composedFromRangeSha, computeHostWarnings, continueInterruptedSessions, continueSkipReason, conversationIndexPath, createActivityProjector, createDaemonReviewerHost, createDefaultHostProbes, createDeviceRegistry, createFileStepCache, createGateway, createHostLoadService, createHostRegistry, createInboundEndpointStore, createJoinTokenRegistry, createOrchestratorInjector, createOrchestratorMcpServerFactory, createPrProvenanceReconciler, createReviewLaneExecutor, createReviewLedger, createReviewPackLoader, createReviewRunner, createScopeTokenRegistry, createSentinelWebhookOutbox, createWorkspaceBrainSubscriber, createWorkspaceBrains, daemonRegistryDir, declaredPresetToProviderPreset, decodeWhsecSecret, defaultBrowserAdapterIds, defaultBrowserAdapterResolution, defaultReviewKeysDir, defaultReviewLedgerRoot, defaultReviewPackCacheDir, defineBraveSearchHttpDriver, defineSerperHttpDriver, deliverEventEnvelope, deliveryBackoffDelay, describeOwner, encodeWhsecSecret, enrichRollupWithProviderQuota, enrichWithRemainingQuota, ensureReviewSigningKey, envelopeClampedBytes, evaluateCostBudget, execGh, extractHelpSection, fetchHostTurns, fetchPrStatus, fileExists, findComposeCandidate, findConversationRecord, findNativeMode, findPrForCommit, formatToolCall, formatToolResult, getDefaultHarnessPreset, getHarnessPreset, getHostLoadService, getMcpCredentialDeps, getToolHelp, githubRepoOf, harnessPresetsPath, hostPlaceholders, hostRecordToMirrorRecord, injectMcpAppBridge, isAgentCliAuthConfigured, isNoSessionPromptFailure, isPubliclyRoutable, isSafeBucketSlug, listBuckets, listHarnessPresets, listPresets, listToolHelpTopics, loadHarnessPresets, loadWorkspaceModelRoles, locateConversationByNativePath, locateConversationBySessionId, makeBrowserAdapterLister, makeSandboxCredsStore, makeSandboxResolver, measureTool, measureToolList, migrateLegacySessionsFile, migrationMarkerPath, mirrorCursorForSession, monitorPolicyWait, monitorSessionWait, narrowOrchestratorTools, normalizeCallbackUrl, normalizeInbound, normalizeModeId, normalizeRemote, parsePrUrl, prHeadSha, projectBrowserTools, promptDeviceSession, promptHostSession, readConversationIndex, readDaemonRegistry, readHostsSnapshot, readRegisteredSlugs, readRuntimeMeta, readSandboxLedger, readSessionForBrain, readUsageSnapshots, reapGcEntry, reapOrphanedDescendants, reconcileSandboxLedger, recordSandboxBoot, recordSandboxLiveness, recordSandboxOrigin, recordSandboxState, registerBrainTools, registerBuiltinRoutes, registerDeviceTools, registerPairingTools, registerReviewTools, registerSandboxAttachTool, registerWebSearchTools, removeHarnessPreset, removeSandboxLedgerEntry, repoSlug, resetChallengeCacheForTests, resolveBucketSlug, resolveDevicePromptMapping, resolveEffectiveLlmEndpointFlag, resolveNativeLink, resolvePosture, resolvePrincipal, resolveReuseFromLedger, resolveReviewerPreset, rollupSessionSubtree, runContinueOnBootPass, runCrashDetectPass, runEagerResumePass, runIdleReapPass, runShellLane, runStallWatchdogPass, sandboxLedgerPath, seedWalkForTranscript, serializeEnvelope, setDefaultPreset, setEgressDispatcherForTests, setMcpCredentialDeps, signAttestation, signWebhook, ssrfFetch, sweepStaleDaemonRegistry, sweepStaleRuntimeMetas, syncDeviceMirror, toWebhookEnvelope, toWorktreeStatusView, unlinkDaemonRegistryEntry, unlinkRuntimeMeta, updateHarnessPreset, upsertSandboxLedger, verifyCallback, verifyInboundSignature, verifySignedAttestation, webSearchTool, webhookRequestId, withPr, withPrStatus, writeDaemonRegistryEntry };
|
|
9373
|
+
export { ActivityListFilter, type ActivityPolicyLister, type ActivityProjector, type ActivityProjectorRegistry, type ActivityProjectorSession, ActivityRecord, type ActivityWorkflowLister, AdapterAuthDescriptor, type AdapterCapabilitiesLister, type AdapterInstallResult, type AdapterListEntry, type AgentAdapterInstaller, type AgentAdapterLister, type AgentAdapterResolver, AgentSessionLike, AgentStreamEvent, type ArgumentsResult, type AttachSandboxOpts, type AttachSandboxResult, BUCKETS_ROOT, type BranchGcClass, type BranchGcCoverageView, type BranchGcHoldReason, type BranchGcKind, type BranchGcOutcomeView, type BranchGcPlanEntryView, type BranchGcPlanView, type BranchGcReclaimReason, type BranchGcResult, type BranchGcRunInput, type BranchGcRunner, type BranchGcStatus, type BranchGcSummaryView, type BranchGcTriageVerdict, type BranchGcVerdictInput, type BranchGcVerdictLookupInput, type BranchGcVerdictReader, type BranchGcVerdictRecordView, type BranchGcVerdictRecorder, type BrowserAdapterHandle, type BrowserAdapterInfo, type BrowserAdapterLister, type BrowserAdapterResolver, BuildHeartbeatAgent, CLAMP_LIMIT_BYTES, CONTINUE_PROMPT_SOURCE, CanonicalPosture, type CapabilitiesInventory, type CapabilitiesInventoryMcp, type CapabilitiesInventorySkills, type CatalogModelsLister, CatalogModelsQuery, CatalogModelsResponse, type CatalogProviderModel, type CatalogProviderModelsQuery, type CatalogProviderModelsResponse, type CatalogProviderPricing, type ChallengeFailureReason, type ChallengeOutcome, type ClaudeNativeRef, CompletionPolicySupervisor, type ComposeCandidate, ContextProfile, type ContinueInterruptedMode, type ContinueInterruptedOutcome, type ContinueInterruptedResult, type ContinueInterruptedSkipReason, type ContinueOnBootSummary, type ConversationIndexRecord, type ConversationNativeRef, type CostBudgetDecision, type CrashDetectSummary, type CrashReaperRegistry, type CreateGatewayOptions, type CreateJoinTokenInput, type CreateReviewRunnerOptions, type CreatedJoinToken, DEAD_SESSION_STATUSES, DEFAULT_ALWAYS_ON_TOOLS, DEFAULT_BUCKET, DEFAULT_CONTINUE_PROMPT, DEFAULT_HOST_LOAD_BUDGET_MS, DEFAULT_HOST_LOAD_THRESHOLDS, DEFAULT_ORCHESTRATOR_TOOLS, DEFAULT_TTL_MS, DEVICE_PROMPT_PATH_PREFIX, type DaemonReviewerHostDeps, DeclaredAdapterOption, type DeclaredAdapterPreset, DefaultsAdapterAuthConfig, type DeliveryOutcome, type DeliveryReplay, type DeliveryState, type Device, type DeviceKind, type DeviceMirrorSyncResult, type DeviceMirrorTarget, type DevicePromptSessionsLike, type DeviceRegistry, type DeviceRole, type DiskLoad, EVENT_REGISTRY, type EagerResumeSummary, type EgressDispatcher, type EnableInput, type EnableResult, type EventDefinition, type EventRegistration, type EventsListContext, type EventsListRequest, type EventsListResult, type EventsSubscribeContext, type EventsSubscribeInput, type EventsSubscribeResult, type EventsUnsubscribeContext, type EventsUnsubscribeInput, type FetchHostTurnsResult, type FindComposeCandidateInput, type ForwardHttpRequest, type ForwardHttpResponse, GC_REAPABLE_STATES, GITHUB_SCHEME, type GatewayHandle, type GhRunner, HOSTS_VERSION, HOST_HANDSHAKE_REMEDIATION_HINT, HOST_SCOPE_HEADER, type HarnessPreset, type HarnessPresetValidationDeps, HarnessPresetValidationError, type HarnessPresetsFile, type HermesNativeRef, type HostEventRecord, type HostJoinMeta, type HostLoadCpu, type HostLoadDetail, type HostLoadMemory, type HostLoadReport, type HostLoadService, type HostLoadSwap, type HostLoadThresholds, type HostProbes, type HostProcess, type HostProcessOwner, type HostRecord, type HostRegistry, type HostRegistryDeps, type HostSessionRollup, type HostWarning, type HostWarningKind, INBOUND_PROVIDERS, INDEX_DEFAULT_LIMIT, INDEX_MAX_OUTPUT, INDEX_MAX_PROMPT, INDEX_TAIL_BYTES, type IdleReapSummary, type IdleReaperRegistry, type InboundEndpoint, type InboundEndpointStore, type InboundEndpointStoreOptions, type InboundEnqueuePrompt, type InboundIsSessionAlive, type InboundMessage, type InboundProvider, type InboundRestartSession, type InboundRouteMode, type InboundRouterDeps, type InboundRouterLog, type InboundSpawnForContact, type InboundWatcher, type InternalEventMeta, JOIN_TOKENS_VERSION, type JoinTokenRecord, type JoinTokenRegistry, type JoinTokenRegistryDeps, LEGACY_SESSIONS_FILE, type LedgerAnnotations, type LedgerEntry, type LedgerHostMeta, type LlmEndpointDescriptor, type LlmEndpointStatus, type LlmEndpointStatusReport, type LocatedConversation, type LocatedConversationByPath, MAX_ATTEMPTS, MAX_AUTO_CONTINUE_ATTEMPTS, MAX_TTL_MS, MCP_APP_BRIDGE_SCRIPT, MIN_TTL_MS, type McpCredentialDeps, type McpEventEnvelope, McpEventsError, type MeasurableTool, type MeasuredToolEntry, MessageKind, MessageUrgency, type MigrationMarker, type ModelRolesInput, type ModelRolesOutput, type NormalizeInboundResult, type OpenPrResolver, type OrchestratorGatewayDeps, type OrchestratorInjection, type OrchestratorInjector, type OrchestratorInjectorDeps, type OrchestratorMcpServerFactory, type OrchestratorScope, type OrphanReaperRegistry, POSTURE_NATIVE_ALIASES, POSTURE_PREAMBLES, type PersistedOutboxRow, PolicyRunState, Posture, type PostureResolution, PrLookupError, type PrLookupErrorCode, PrResolvedState, type PrStateResolver, type PrStatusSnapshot, type PresetInfo, type Principal, type ProjectBrowserToolsOptions, type ProjectedBrowserTool, type ProjectedBrowserTools, type ProjectedProvider, type ProjectedToolResult, type PromptHostSessionInput, type PromptHostSessionResult, ProvisionInFlight, QuotaReadableProfile, type RegisterBrainToolsOptions, type RegisterDeviceToolsOptions, type RegisterPairingToolsOptions, type RegisterReviewToolsOptions, type RegisterWebSearchToolsOptions, RemainingQuotaReader, type RemoteStatus, type ResolveNativeLinkInput, ResolvedAuthSpec, ResolvedModelRole, type ReuseResolution, type ReviewComposeContext, type ReviewLedger, type ReviewLedgerFilter, type ReviewRun, type ReviewRunInput, type ReviewRunStatus, type ReviewRunner, type ReviewSignature, type ReviewSigningKey, type ReviewerRunResult, type ReviewerSessionHost, type RouteAwareLaunchConfig, type RouteAwareLaunchConfigInput, RouteSpec, type RuntimeMeta, SIGN_NAMESPACE, type SandboxAdapterInfo, type SandboxConnectionDescriptor, type SandboxGcCandidate, type SandboxGcProviderHandle, type SandboxGcReapDeps, type SandboxGcReapResult, type SandboxLedgerEntry, type SandboxLedgerState, type SandboxProviderCapabilities, type SandboxProviderHandle, type SandboxProviderLister, type SandboxProviderResolver, type SandboxReconcileDeps, type SandboxReconcileProviderHandle, type SandboxReconcileResult, type SandboxReconcileRow, type SandboxReconcileVerdict, type SchemeRegistry, type ScopeTokenRegistry, type SentinelMatchClause, type SentinelSpec, type SentinelStatus, type SentinelTarget, type SentinelUntil, type SentinelView, type SentinelWebhookOutbox, type SentinelWebhookOutboxOptions, type SentinelWebhookOutboxRow, type SentinelWebhookOutboxStatus, SessionDescriptor, SessionEndReason, type SessionIndexEntry, SessionMessage, type SessionMessageSentRecord, type SessionObserver, type SessionRecap, SessionUsage, type SessionUsageWithSubtree, type SessionWaitEvent, type SessionWaitResult, SessionsRegistry, type SkillPackInventoryEntry, type SkillsByHarnessEntry, SpawnDefaultsConfig, SsrfFetchError, type SsrfFetchInit, type SsrfFetchReason, type SsrfFetchResult, type StallWatchdogRegistry, type StallWatchdogSummary, type SubscriptionIdentity, type SubtreeChildUsage, type SubtreeUsageTotals, TaskLedger, type ToolListMeasurement, type TranscriptPrompt, type TranscriptTail, type TransmitterBinding, type TransmitterBindingStore, type TunnelDescriptor, type TunnelProvider, type TunnelStatus, UsageReadContext, UsageReadResult, UsageRollup, UsageSnapshotRecord, UserPreset, type VerifyCallbackInput, type VerifySignedAttestationResult, type WatcherDescriptor, type WatcherStartInput, type WebSearchInput, type WebSearchOutput, type WebSearchResult, type WebhookSignInput, type WebhookSignatureHeaders, type WorkspaceBrainSubscriber, type WorkspaceBrainSubscriberOptions, type WorkspaceBrains, WorkspaceFs, WorktreeAutoReclaimer, WorktreeField, type WorktreeGcClass, type WorktreeGcOutcomeView, type WorktreeGcPlanEntryView, type WorktreeGcReclaimReason, type WorktreeGcResult, type WorktreeGcRunInput, type WorktreeGcRunner, WorktreeIsolationMode, WorktreeProvisioner, type WorktreeStatusLister, type WorktreeStatusView, addHarnessPreset, allowedSignersLine, appendConversationRecord, attachSandbox, backfillSessionIndexes, bucketDir, bucketSessionsFile, bucketTranscriptDir, buildCatalogProviderModels, buildHostLoadReport, buildMcpConfigSnippet, buildRouteAwareLaunchConfig, buildSessionRecap, canonicalForModeId, canonicalizeJcs, challengeCacheSize, challengeReasonForSsrf, claudeProjectSlug, collectGcCandidates, collectHostSample, composeSessionObservers, composedFromRangeSha, computeHostWarnings, computeRefreshBefore, continueInterruptedSessions, continueSkipReason, conversationIndexPath, createActivityProjector, createDaemonReviewerHost, createDefaultHostProbes, createDeviceRegistry, createFileStepCache, createGateway, createHostLoadService, createHostRegistry, createInboundEndpointStore, createJoinTokenRegistry, createOrchestratorInjector, createOrchestratorMcpServerFactory, createPrProvenanceReconciler, createReviewLaneExecutor, createReviewLedger, createReviewPackLoader, createReviewRunner, createScopeTokenRegistry, createSentinelWebhookOutbox, createWorkspaceBrainSubscriber, createWorkspaceBrains, daemonBearerPrincipal, daemonRegistryDir, declaredPresetToProviderPreset, decodeWhsecSecret, defaultBrowserAdapterIds, defaultBrowserAdapterResolution, defaultReviewKeysDir, defaultReviewLedgerRoot, defaultReviewPackCacheDir, defaultTranscriptBaseDir, defineBraveSearchHttpDriver, defineSerperHttpDriver, deliverEventEnvelope, deliveryBackoffDelay, deriveIndexFromTranscript, describeOwner, encodeWhsecSecret, enrichRollupWithProviderQuota, enrichWithRemainingQuota, ensureReviewSigningKey, envelopeClampedBytes, evaluateCostBudget, eventsList, eventsSubscribe, eventsUnsubscribe, execGh, extractHelpSection, fetchHostTurns, fetchPrStatus, fileExists, findComposeCandidate, findConversationRecord, findEventDefinition, findNativeMode, findPrForCommit, formatToolCall, formatToolResult, getDefaultHarnessPreset, getHarnessPreset, getHostLoadService, getMcpCredentialDeps, getToolHelp, githubRepoOf, harnessPresetsPath, hostPlaceholders, hostRecordToMirrorRecord, indexEntryFromDescriptor, injectMcpAppBridge, isAgentCliAuthConfigured, isNoSessionPromptFailure, isPubliclyRoutable, isSafeBucketSlug, listBuckets, listHarnessPresets, listPresets, listToolHelpTopics, loadHarnessPresets, loadWorkspaceModelRoles, locateConversationByNativePath, locateConversationBySessionId, makeBrowserAdapterLister, makeSandboxCredsStore, makeSandboxResolver, matchesSessionQuery, measureTool, measureToolList, migrateLegacySessionsFile, migrationMarkerPath, mirrorCursorForSession, monitorPolicyWait, monitorSessionWait, narrowOrchestratorTools, normalizeCallbackUrl, normalizeInbound, normalizeModeId, normalizeRemote, parsePrUrl, prHeadSha, projectBrowserTools, promptDeviceSession, promptHostSession, readAllSessionIndexes, readConversationIndex, readDaemonRegistry, readHostsSnapshot, readRegisteredSlugs, readRuntimeMeta, readSandboxLedger, readSessionForBrain, readSessionIndex, readTranscriptTail, readUsageSnapshots, reapGcEntry, reapOrphanedDescendants, reconcileSandboxLedger, recordSandboxBoot, recordSandboxLiveness, recordSandboxOrigin, recordSandboxState, registerBrainTools, registerBuiltinRoutes, registerDeviceTools, registerPairingTools, registerReviewTools, registerSandboxAttachTool, registerWebSearchTools, removeHarnessPreset, removeSandboxLedgerEntry, repoSlug, resetChallengeCacheForTests, resolveBucketSlug, resolveDevicePromptMapping, resolveEffectiveLlmEndpointFlag, resolveNativeLink, resolvePosture, resolvePrincipal, resolveReuseFromLedger, resolveReviewerPreset, rollupSessionSubtree, runContinueOnBootPass, runCrashDetectPass, runEagerResumePass, runIdleReapPass, runShellLane, runStallWatchdogPass, sandboxLedgerPath, searchSessionIndexes, seedWalkForTranscript, serializeEnvelope, sessionEventsPath, sessionIndexPath, sessionPrincipal, sessionTranscriptDir, setDefaultPreset, setDefaultSessionsBaseDir, setEgressDispatcherForTests, setMcpCredentialDeps, signAttestation, signWebhook, ssrfFetch, subscriptionId, sweepStaleDaemonRegistry, sweepStaleRuntimeMetas, syncDeviceMirror, tenantScope, toMcpEvent, toWebhookEnvelope, toWorktreeStatusView, unlinkDaemonRegistryEntry, unlinkRuntimeMeta, untilForTtl, updateHarnessPreset, upsertSandboxLedger, validateAgainstInputSchema, verifyCallback, verifyInboundSignature, verifySignedAttestation, webSearchTool, webhookRequestId, withPr, withPrStatus, writeDaemonRegistryEntry, writeSessionIndex };
|