@openscout/protocol 0.2.63 → 0.2.82
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/LICENSE +202 -0
- package/README.md +103 -52
- package/dist/a2a.d.ts +224 -0
- package/dist/a2a.d.ts.map +1 -0
- package/dist/a2a.js +225 -0
- package/dist/activity.d.ts +70 -0
- package/dist/activity.d.ts.map +1 -0
- package/dist/activity.js +1 -0
- package/dist/actors.d.ts +7 -3
- package/dist/actors.d.ts.map +1 -0
- package/dist/actors.js +15 -1
- package/dist/agent-broker-feed.d.ts +84 -0
- package/dist/agent-broker-feed.d.ts.map +1 -0
- package/dist/agent-broker-feed.js +1 -0
- package/dist/agent-identity.d.ts +23 -0
- package/dist/agent-identity.d.ts.map +1 -0
- package/dist/agent-identity.js +122 -8
- package/dist/agent-runs.d.ts +191 -0
- package/dist/agent-runs.d.ts.map +1 -0
- package/dist/agent-runs.js +365 -0
- package/dist/assigned-roles.d.ts +205 -0
- package/dist/assigned-roles.d.ts.map +1 -0
- package/dist/assigned-roles.js +228 -0
- package/dist/broker-routes.d.ts +40 -0
- package/dist/broker-routes.d.ts.map +1 -0
- package/dist/broker-routes.js +56 -0
- package/dist/budget.d.ts +65 -0
- package/dist/budget.d.ts.map +1 -0
- package/dist/budget.js +19 -0
- package/dist/capability-matrix.d.ts +230 -0
- package/dist/capability-matrix.d.ts.map +1 -0
- package/dist/capability-matrix.js +304 -0
- package/dist/channel-identity.d.ts +40 -0
- package/dist/channel-identity.d.ts.map +1 -0
- package/dist/channel-identity.js +108 -0
- package/dist/collaboration.d.ts +45 -16
- package/dist/collaboration.d.ts.map +1 -0
- package/dist/collaboration.js +39 -23
- package/dist/common.d.ts +4 -3
- package/dist/common.d.ts.map +1 -0
- package/dist/conversations.d.ts +1 -0
- package/dist/conversations.d.ts.map +1 -0
- package/dist/cursor-transport.d.ts +22 -0
- package/dist/cursor-transport.d.ts.map +1 -0
- package/dist/cursor-transport.js +10 -0
- package/dist/debug-attach.d.ts +29 -0
- package/dist/debug-attach.d.ts.map +1 -0
- package/dist/debug-attach.js +6 -0
- package/dist/deliveries.d.ts +16 -2
- package/dist/deliveries.d.ts.map +1 -0
- package/dist/durable-actions.d.ts +94 -0
- package/dist/durable-actions.d.ts.map +1 -0
- package/dist/durable-actions.js +1 -0
- package/dist/events.d.ts +27 -1
- package/dist/events.d.ts.map +1 -0
- package/dist/events.js +14 -1
- package/dist/harness-feature-support.d.ts +76 -0
- package/dist/harness-feature-support.d.ts.map +1 -0
- package/dist/harness-feature-support.js +29 -0
- package/dist/host-integrations.d.ts +22 -0
- package/dist/host-integrations.d.ts.map +1 -0
- package/dist/host-integrations.js +64 -0
- package/dist/inbox.d.ts +50 -0
- package/dist/inbox.d.ts.map +1 -0
- package/dist/inbox.js +9 -0
- package/dist/index.d.ts +36 -2
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +35 -2
- package/dist/invocations.d.ts +121 -0
- package/dist/invocations.d.ts.map +1 -0
- package/dist/invocations.js +201 -1
- package/dist/mesh.d.ts +98 -0
- package/dist/mesh.d.ts.map +1 -0
- package/dist/mesh.js +18 -1
- package/dist/messages.d.ts +3 -0
- package/dist/messages.d.ts.map +1 -0
- package/dist/native-interactions.d.ts +30 -0
- package/dist/native-interactions.d.ts.map +1 -0
- package/dist/native-interactions.js +51 -0
- package/dist/observed-status.d.ts +33 -0
- package/dist/observed-status.d.ts.map +1 -0
- package/dist/observed-status.js +6 -0
- package/dist/orchestrator-prompt.d.ts +10 -0
- package/dist/orchestrator-prompt.d.ts.map +1 -0
- package/dist/orchestrator-prompt.js +36 -0
- package/dist/permission-policy.d.ts +5 -0
- package/dist/permission-policy.d.ts.map +1 -0
- package/dist/permission-policy.js +15 -0
- package/dist/provisional-agent-names.d.ts +30 -0
- package/dist/provisional-agent-names.d.ts.map +1 -0
- package/dist/provisional-agent-names.js +224 -0
- package/dist/read-receipts.d.ts +12 -0
- package/dist/read-receipts.d.ts.map +1 -0
- package/dist/read-receipts.js +1 -0
- package/dist/relay-agent-card.d.ts +10 -0
- package/dist/relay-agent-card.d.ts.map +1 -0
- package/dist/rendezvous.d.ts +97 -0
- package/dist/rendezvous.d.ts.map +1 -0
- package/dist/rendezvous.js +35 -0
- package/dist/reserved-vocabulary.d.ts +21 -0
- package/dist/reserved-vocabulary.d.ts.map +1 -0
- package/dist/reserved-vocabulary.js +101 -0
- package/dist/route-aliases.d.ts +112 -0
- package/dist/route-aliases.d.ts.map +1 -0
- package/dist/route-aliases.js +1 -0
- package/dist/runtime-catalog-contract.d.ts +39 -0
- package/dist/runtime-catalog-contract.d.ts.map +1 -0
- package/dist/runtime-catalog-contract.js +17 -0
- package/dist/runtime-catalog.d.ts +11 -0
- package/dist/runtime-catalog.d.ts.map +1 -0
- package/dist/runtime-catalog.generated.d.ts +230 -0
- package/dist/runtime-catalog.generated.d.ts.map +1 -0
- package/dist/runtime-catalog.generated.js +299 -0
- package/dist/runtime-catalog.js +192 -0
- package/dist/runtime-execution.d.ts +161 -0
- package/dist/runtime-execution.d.ts.map +1 -0
- package/dist/runtime-execution.js +327 -0
- package/dist/runtime-profiles.d.ts +12 -0
- package/dist/runtime-profiles.d.ts.map +1 -0
- package/dist/runtime-profiles.js +20 -0
- package/dist/scout-agent-card.d.ts +10 -0
- package/dist/scout-agent-card.d.ts.map +1 -0
- package/dist/scout-composer.d.ts +27 -0
- package/dist/scout-composer.d.ts.map +1 -0
- package/dist/scout-composer.js +192 -0
- package/dist/scout-delivery.d.ts +101 -4
- package/dist/scout-delivery.d.ts.map +1 -0
- package/dist/scout-dispatch.d.ts +44 -3
- package/dist/scout-dispatch.d.ts.map +1 -0
- package/dist/scout-reply-context.d.ts +14 -0
- package/dist/scout-reply-context.d.ts.map +1 -0
- package/dist/scout-reply-context.js +1 -0
- package/dist/session-display-state.d.ts +132 -0
- package/dist/session-display-state.d.ts.map +1 -0
- package/dist/session-display-state.js +94 -0
- package/dist/terminal-host-topology.d.ts +119 -0
- package/dist/terminal-host-topology.d.ts.map +1 -0
- package/dist/terminal-host-topology.js +21 -0
- package/dist/terminal-sessions.d.ts +142 -0
- package/dist/terminal-sessions.d.ts.map +1 -0
- package/dist/terminal-sessions.js +81 -0
- package/dist/terminal-surface-id.d.ts +73 -0
- package/dist/terminal-surface-id.d.ts.map +1 -0
- package/dist/terminal-surface-id.js +162 -0
- package/dist/terminal-workspaces.d.ts +199 -0
- package/dist/terminal-workspaces.d.ts.map +1 -0
- package/dist/terminal-workspaces.js +287 -0
- package/dist/thread-events.d.ts +1 -0
- package/dist/thread-events.d.ts.map +1 -0
- package/dist/time.d.ts +16 -0
- package/dist/time.d.ts.map +1 -0
- package/dist/time.js +33 -0
- package/dist/transports.d.ts +1 -0
- package/dist/transports.d.ts.map +1 -0
- package/package.json +37 -9
- package/src/a2a.ts +471 -0
- package/src/activity.ts +113 -0
- package/src/actors.ts +42 -8
- package/src/agent-broker-feed.ts +102 -0
- package/src/agent-identity.ts +143 -8
- package/src/agent-runs.ts +675 -0
- package/src/assigned-roles.ts +437 -0
- package/src/broker-routes.ts +62 -0
- package/src/budget.ts +88 -0
- package/src/capability-matrix.ts +648 -0
- package/src/channel-identity.ts +147 -0
- package/src/collaboration.ts +78 -48
- package/src/common.ts +24 -5
- package/src/cursor-transport.ts +34 -0
- package/src/debug-attach.ts +38 -0
- package/src/deliveries.ts +16 -1
- package/src/durable-actions.ts +125 -0
- package/src/events.ts +31 -0
- package/src/harness-feature-support.ts +116 -0
- package/src/host-integrations.ts +104 -0
- package/src/inbox.ts +68 -0
- package/src/index.ts +35 -2
- package/src/invocations.ts +353 -0
- package/src/mesh.ts +130 -0
- package/src/messages.ts +2 -0
- package/src/native-interactions.ts +100 -0
- package/src/observed-status.ts +90 -0
- package/src/orchestrator-prompt.ts +47 -0
- package/src/permission-policy.ts +21 -0
- package/src/provisional-agent-names.ts +272 -0
- package/src/read-receipts.ts +12 -0
- package/src/relay-agent-card.ts +73 -63
- package/src/rendezvous.ts +154 -0
- package/src/reserved-vocabulary.ts +135 -0
- package/src/route-aliases.ts +130 -0
- package/src/runtime-catalog-contract.ts +60 -0
- package/src/runtime-catalog.generated.ts +300 -0
- package/src/runtime-catalog.md +21 -0
- package/src/runtime-catalog.ts +193 -0
- package/src/runtime-catalog.v1.json +81 -0
- package/src/runtime-execution.ts +545 -0
- package/src/runtime-profiles.ts +37 -0
- package/src/scout-agent-card.ts +10 -0
- package/src/scout-composer.ts +249 -0
- package/src/scout-delivery.ts +117 -4
- package/src/scout-dispatch.ts +34 -2
- package/src/scout-reply-context.ts +15 -0
- package/src/session-display-state.ts +202 -0
- package/src/terminal-host-topology.ts +132 -0
- package/src/terminal-sessions.ts +187 -0
- package/src/terminal-surface-id.ts +189 -0
- package/src/terminal-workspaces.ts +455 -0
- package/src/time.ts +49 -0
- package/dist/agent-address.d.ts +0 -1
- package/dist/agent-address.js +0 -1
- package/dist/agent-selectors.d.ts +0 -1
- package/dist/agent-selectors.js +0 -1
- package/src/agent-address.ts +0 -1
- package/src/agent-identity.test.ts +0 -435
- package/src/agent-selectors.ts +0 -1
- package/src/scout-agent-card.test.ts +0 -54
package/dist/agent-identity.js
CHANGED
|
@@ -286,14 +286,35 @@ function candidateAliases(candidate) {
|
|
|
286
286
|
];
|
|
287
287
|
return Array.from(new Set(aliases.map((alias) => trimIdentityPrefix(alias)).filter(Boolean)));
|
|
288
288
|
}
|
|
289
|
+
// Directory-wide operations (formatMinimalAgentIdentity, diagnoseAgentIdentity)
|
|
290
|
+
// evaluate these per candidate pair, and broker snapshots can carry thousands
|
|
291
|
+
// of candidates — recomputing parse/construct work per visit turns those
|
|
292
|
+
// call sites quadratic in heavy string handling. Candidates are treated as
|
|
293
|
+
// immutable once they enter these pipelines, so per-object memoization is safe.
|
|
294
|
+
const explicitAliasesCache = new WeakMap();
|
|
295
|
+
const aliasKeysCache = new WeakMap();
|
|
296
|
+
const canonicalIdentityCache = new WeakMap();
|
|
289
297
|
function explicitCandidateAliases(candidate) {
|
|
298
|
+
const cached = explicitAliasesCache.get(candidate);
|
|
299
|
+
if (cached)
|
|
300
|
+
return cached;
|
|
290
301
|
const canonical = candidateCanonicalIdentity(candidate);
|
|
291
302
|
const implicitAliases = canonical?.definitionId === OPENSCOUT_COORDINATOR_AGENT_ID
|
|
292
303
|
? [SCOUT_DISPATCHER_AGENT_ID]
|
|
293
304
|
: [];
|
|
294
|
-
|
|
305
|
+
const aliases = Array.from(new Set([...(candidate.aliases ?? []), ...implicitAliases]
|
|
295
306
|
.map((alias) => normalizeAgentIdentitySegment(trimIdentityPrefix(alias)))
|
|
296
307
|
.filter(Boolean)));
|
|
308
|
+
explicitAliasesCache.set(candidate, aliases);
|
|
309
|
+
return aliases;
|
|
310
|
+
}
|
|
311
|
+
function candidateAliasKeys(candidate) {
|
|
312
|
+
const cached = aliasKeysCache.get(candidate);
|
|
313
|
+
if (cached)
|
|
314
|
+
return cached;
|
|
315
|
+
const keys = explicitCandidateAliases(candidate).map(canonicalizeAliasValue);
|
|
316
|
+
aliasKeysCache.set(candidate, keys);
|
|
317
|
+
return keys;
|
|
297
318
|
}
|
|
298
319
|
function canonicalizeAliasValue(value) {
|
|
299
320
|
const parsed = parseAgentIdentity(value.startsWith("@") ? value : `@${value}`);
|
|
@@ -310,7 +331,10 @@ function identityAliasKeys(identity) {
|
|
|
310
331
|
].filter(Boolean)));
|
|
311
332
|
}
|
|
312
333
|
function candidateCanonicalIdentity(candidate) {
|
|
313
|
-
|
|
334
|
+
if (canonicalIdentityCache.has(candidate)) {
|
|
335
|
+
return canonicalIdentityCache.get(candidate) ?? null;
|
|
336
|
+
}
|
|
337
|
+
const canonical = constructAgentIdentity({
|
|
314
338
|
definitionId: candidate.definitionId || candidate.agentId,
|
|
315
339
|
nodeQualifier: candidate.nodeQualifier,
|
|
316
340
|
workspaceQualifier: candidate.workspaceQualifier,
|
|
@@ -318,6 +342,8 @@ function candidateCanonicalIdentity(candidate) {
|
|
|
318
342
|
harness: candidate.harness,
|
|
319
343
|
model: candidate.model,
|
|
320
344
|
});
|
|
345
|
+
canonicalIdentityCache.set(candidate, canonical);
|
|
346
|
+
return canonical;
|
|
321
347
|
}
|
|
322
348
|
function candidateDimensionValue(candidate, dimension) {
|
|
323
349
|
const canonical = candidateCanonicalIdentity(candidate);
|
|
@@ -334,6 +360,65 @@ function candidateDimensionValue(candidate, dimension) {
|
|
|
334
360
|
return canonical.model;
|
|
335
361
|
return canonical.nodeQualifier;
|
|
336
362
|
}
|
|
363
|
+
function normalizeAgentReferenceValue(value) {
|
|
364
|
+
return value?.trim().toLowerCase().replace(/[^a-z0-9]/g, "") ?? "";
|
|
365
|
+
}
|
|
366
|
+
function candidateReferenceValue(candidate) {
|
|
367
|
+
return normalizeAgentReferenceValue(candidate.referenceId
|
|
368
|
+
|| candidate.workspaceQualifier
|
|
369
|
+
|| candidate.agentId);
|
|
370
|
+
}
|
|
371
|
+
function candidateReferenceSuffix(candidate, length) {
|
|
372
|
+
const value = candidateReferenceValue(candidate);
|
|
373
|
+
if (!value) {
|
|
374
|
+
return "";
|
|
375
|
+
}
|
|
376
|
+
return value.length <= length ? value : value.slice(-length);
|
|
377
|
+
}
|
|
378
|
+
export function formatAgentReferenceIdentity(candidate, candidates, options = {}) {
|
|
379
|
+
const canonical = candidateCanonicalIdentity(candidate);
|
|
380
|
+
if (!canonical) {
|
|
381
|
+
return options.includeSigil === false ? "" : "@";
|
|
382
|
+
}
|
|
383
|
+
const minLength = Math.max(1, options.minLength ?? 5);
|
|
384
|
+
const maxLength = Math.max(minLength, options.maxLength ?? 8);
|
|
385
|
+
const peers = candidates.filter((peer) => {
|
|
386
|
+
if (peer === candidate) {
|
|
387
|
+
return false;
|
|
388
|
+
}
|
|
389
|
+
const peerCanonical = candidateCanonicalIdentity(peer);
|
|
390
|
+
return peerCanonical?.definitionId === canonical.definitionId;
|
|
391
|
+
});
|
|
392
|
+
let suffix = "";
|
|
393
|
+
for (let length = minLength; length <= maxLength; length += 1) {
|
|
394
|
+
const candidateSuffix = candidateReferenceSuffix(candidate, length);
|
|
395
|
+
if (!candidateSuffix) {
|
|
396
|
+
break;
|
|
397
|
+
}
|
|
398
|
+
suffix = candidateSuffix;
|
|
399
|
+
const collides = peers.some((peer) => candidateReferenceSuffix(peer, length) === candidateSuffix);
|
|
400
|
+
if (!collides) {
|
|
401
|
+
break;
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
if (!suffix) {
|
|
405
|
+
return formatAgentIdentity({ definitionId: canonical.definitionId }, options);
|
|
406
|
+
}
|
|
407
|
+
return formatAgentIdentity({
|
|
408
|
+
definitionId: canonical.definitionId,
|
|
409
|
+
workspaceQualifier: suffix,
|
|
410
|
+
}, options);
|
|
411
|
+
}
|
|
412
|
+
export function withAgentReferenceAliases(candidates) {
|
|
413
|
+
return candidates.map((candidate) => {
|
|
414
|
+
const alias = formatAgentReferenceIdentity(candidate, candidates);
|
|
415
|
+
const aliases = Array.from(new Set([...(candidate.aliases ?? []), alias].filter(Boolean)));
|
|
416
|
+
return {
|
|
417
|
+
...candidate,
|
|
418
|
+
aliases,
|
|
419
|
+
};
|
|
420
|
+
});
|
|
421
|
+
}
|
|
337
422
|
function modelAliasKeys(value) {
|
|
338
423
|
const normalized = value ? normalizeAgentIdentitySegment(value) : "";
|
|
339
424
|
if (!normalized) {
|
|
@@ -407,8 +492,8 @@ export function resolveAgentIdentity(identity, candidates) {
|
|
|
407
492
|
export function diagnoseAgentIdentity(identity, candidates) {
|
|
408
493
|
const aliasKeys = identityAliasKeys(identity);
|
|
409
494
|
const exactAliasMatches = candidates.filter((candidate) => {
|
|
410
|
-
const
|
|
411
|
-
return aliasKeys.some((key) =>
|
|
495
|
+
const keys = candidateAliasKeys(candidate);
|
|
496
|
+
return keys.length > 0 && aliasKeys.some((key) => keys.includes(key));
|
|
412
497
|
});
|
|
413
498
|
if (exactAliasMatches.length === 1) {
|
|
414
499
|
return { kind: "resolved", match: exactAliasMatches[0] };
|
|
@@ -478,15 +563,33 @@ function buildIdentitySubset(candidate, dimensions) {
|
|
|
478
563
|
...(dimensions.includes("node") && canonical.nodeQualifier ? { nodeQualifier: canonical.nodeQualifier } : {}),
|
|
479
564
|
});
|
|
480
565
|
}
|
|
566
|
+
const peersByDefinitionCache = new WeakMap();
|
|
567
|
+
function peersByDefinitionId(candidates) {
|
|
568
|
+
const cached = peersByDefinitionCache.get(candidates);
|
|
569
|
+
if (cached)
|
|
570
|
+
return cached;
|
|
571
|
+
const groups = new Map();
|
|
572
|
+
for (const candidate of candidates) {
|
|
573
|
+
const canonical = candidateCanonicalIdentity(candidate);
|
|
574
|
+
if (!canonical)
|
|
575
|
+
continue;
|
|
576
|
+
const group = groups.get(canonical.definitionId);
|
|
577
|
+
if (group) {
|
|
578
|
+
group.push(candidate);
|
|
579
|
+
}
|
|
580
|
+
else {
|
|
581
|
+
groups.set(canonical.definitionId, [candidate]);
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
peersByDefinitionCache.set(candidates, groups);
|
|
585
|
+
return groups;
|
|
586
|
+
}
|
|
481
587
|
export function formatMinimalAgentIdentity(candidate, candidates, options = {}) {
|
|
482
588
|
const canonical = candidateCanonicalIdentity(candidate);
|
|
483
589
|
if (!canonical) {
|
|
484
590
|
return options.includeSigil === false ? "" : "@";
|
|
485
591
|
}
|
|
486
|
-
const peers = candidates.
|
|
487
|
-
const peerCanonical = candidateCanonicalIdentity(peer);
|
|
488
|
-
return peerCanonical && peerCanonical.definitionId === canonical.definitionId;
|
|
489
|
-
});
|
|
592
|
+
const peers = peersByDefinitionId(candidates).get(canonical.definitionId) ?? [];
|
|
490
593
|
const aliasMatches = explicitCandidateAliases(candidate)
|
|
491
594
|
.map((alias) => ({ alias, identity: parseAgentIdentity(`@${alias}`) }))
|
|
492
595
|
.filter((entry) => Boolean(entry.identity))
|
|
@@ -519,14 +622,25 @@ export function formatMinimalAgentIdentity(candidate, candidates, options = {})
|
|
|
519
622
|
}
|
|
520
623
|
return formatAgentIdentity(canonical, options);
|
|
521
624
|
}
|
|
625
|
+
/** @deprecated Use {@link parseAgentIdentity} instead. */
|
|
522
626
|
export const parseAgentAddress = parseAgentIdentity;
|
|
627
|
+
/** @deprecated Use {@link formatAgentIdentity} instead. */
|
|
523
628
|
export const formatAgentAddress = formatAgentIdentity;
|
|
629
|
+
/** @deprecated Use {@link constructAgentIdentity} instead. */
|
|
524
630
|
export const constructAgentAddress = constructAgentIdentity;
|
|
631
|
+
/** @deprecated Use {@link extractAgentIdentities} instead. */
|
|
525
632
|
export const extractAgentAddresses = extractAgentIdentities;
|
|
633
|
+
/** @deprecated Use {@link agentIdentityMatches} instead. */
|
|
526
634
|
export const agentAddressMatches = agentIdentityMatches;
|
|
635
|
+
/** @deprecated Use {@link resolveAgentIdentity} instead. */
|
|
527
636
|
export const resolveAgentAddress = resolveAgentIdentity;
|
|
637
|
+
/** @deprecated Use {@link parseAgentIdentity} instead. */
|
|
528
638
|
export const parseAgentSelector = parseAgentIdentity;
|
|
639
|
+
/** @deprecated Use {@link formatAgentIdentity} instead. */
|
|
529
640
|
export const formatAgentSelector = formatAgentIdentity;
|
|
641
|
+
/** @deprecated Use {@link extractAgentIdentities} instead. */
|
|
530
642
|
export const extractAgentSelectors = extractAgentIdentities;
|
|
643
|
+
/** @deprecated Use {@link agentIdentityMatches} instead. */
|
|
531
644
|
export const agentSelectorMatches = agentIdentityMatches;
|
|
645
|
+
/** @deprecated Use {@link resolveAgentIdentity} instead. */
|
|
532
646
|
export const resolveAgentSelector = resolveAgentIdentity;
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import type { AgentHarness } from "./actors.js";
|
|
2
|
+
import type { MetadataMap, ScoutId, VisibilityScope } from "./common.js";
|
|
3
|
+
import type { FlightRecord, Invocation, InvocationExecutionPreference, InvocationRequest } from "./invocations.js";
|
|
4
|
+
import { type ScoutPermissionProfile } from "./permission-policy.js";
|
|
5
|
+
export declare const AGENT_RUN_STATES: readonly ["queued", "waking", "running", "waiting", "review", "completed", "failed", "cancelled", "unknown"];
|
|
6
|
+
export type AgentRunState = typeof AGENT_RUN_STATES[number];
|
|
7
|
+
export declare const AGENT_RUN_SOURCES: readonly ["ask", "message", "schedule", "recipe", "external_issue", "manual", "eval", "unknown"];
|
|
8
|
+
export type AgentRunSource = typeof AGENT_RUN_SOURCES[number];
|
|
9
|
+
export declare const AGENT_RUN_REVIEW_STATES: readonly ["none", "needed", "blocked", "approved", "rejected"];
|
|
10
|
+
export type AgentRunReviewState = typeof AGENT_RUN_REVIEW_STATES[number];
|
|
11
|
+
export interface AgentRevisionSnapshot {
|
|
12
|
+
id?: ScoutId;
|
|
13
|
+
agentId?: ScoutId;
|
|
14
|
+
definitionId?: ScoutId;
|
|
15
|
+
revision?: number | string;
|
|
16
|
+
digest?: string;
|
|
17
|
+
displayName?: string;
|
|
18
|
+
runtime?: {
|
|
19
|
+
harness?: AgentHarness;
|
|
20
|
+
transport?: string;
|
|
21
|
+
model?: string;
|
|
22
|
+
reasoningEffort?: string;
|
|
23
|
+
session?: InvocationExecutionPreference["session"];
|
|
24
|
+
launchArgs?: string[];
|
|
25
|
+
};
|
|
26
|
+
permissions?: {
|
|
27
|
+
permissionProfile?: ScoutPermissionProfile | string;
|
|
28
|
+
sandbox?: string;
|
|
29
|
+
approvalPolicy?: string;
|
|
30
|
+
enforcementLevel?: string;
|
|
31
|
+
secretRefs?: string[];
|
|
32
|
+
};
|
|
33
|
+
workspace?: {
|
|
34
|
+
projectRoot?: string;
|
|
35
|
+
cwd?: string;
|
|
36
|
+
mode?: "shared" | "isolated" | "external_sandbox";
|
|
37
|
+
hooks?: string[];
|
|
38
|
+
};
|
|
39
|
+
provenance?: {
|
|
40
|
+
source?: "managed_agent" | "ad_hoc" | "imported" | "promotion";
|
|
41
|
+
sourceRef?: string;
|
|
42
|
+
parentRevisionId?: ScoutId;
|
|
43
|
+
};
|
|
44
|
+
metadata?: MetadataMap;
|
|
45
|
+
}
|
|
46
|
+
export interface AgentRunMetrics {
|
|
47
|
+
inputTokens?: number;
|
|
48
|
+
outputTokens?: number;
|
|
49
|
+
totalTokens?: number;
|
|
50
|
+
estimatedUsd?: number;
|
|
51
|
+
wallClockMs?: number;
|
|
52
|
+
toolCallCount?: number;
|
|
53
|
+
retryCount?: number;
|
|
54
|
+
}
|
|
55
|
+
export interface AgentRun {
|
|
56
|
+
id: ScoutId;
|
|
57
|
+
source: AgentRunSource;
|
|
58
|
+
requesterId: ScoutId;
|
|
59
|
+
agentId: ScoutId;
|
|
60
|
+
agentRevisionId?: ScoutId;
|
|
61
|
+
agentRevisionSnapshot?: AgentRevisionSnapshot;
|
|
62
|
+
aliasId?: ScoutId;
|
|
63
|
+
workId?: ScoutId;
|
|
64
|
+
collaborationRecordId?: ScoutId;
|
|
65
|
+
conversationId?: ScoutId;
|
|
66
|
+
messageId?: ScoutId;
|
|
67
|
+
invocationId?: ScoutId;
|
|
68
|
+
flightIds?: ScoutId[];
|
|
69
|
+
parentRunId?: ScoutId;
|
|
70
|
+
rootRunId?: ScoutId;
|
|
71
|
+
recipeId?: ScoutId;
|
|
72
|
+
attempt?: number;
|
|
73
|
+
idempotencyKey?: string;
|
|
74
|
+
state: AgentRunState;
|
|
75
|
+
reviewState?: AgentRunReviewState;
|
|
76
|
+
terminalReason?: string;
|
|
77
|
+
input: MetadataMap;
|
|
78
|
+
output?: MetadataMap;
|
|
79
|
+
artifactIds?: ScoutId[];
|
|
80
|
+
reviewTaskIds?: ScoutId[];
|
|
81
|
+
traceSessionIds?: ScoutId[];
|
|
82
|
+
createdAt: number;
|
|
83
|
+
startedAt?: number;
|
|
84
|
+
updatedAt: number;
|
|
85
|
+
completedAt?: number;
|
|
86
|
+
harness?: AgentHarness;
|
|
87
|
+
model?: string;
|
|
88
|
+
permissionProfile?: ScoutPermissionProfile;
|
|
89
|
+
metrics?: AgentRunMetrics;
|
|
90
|
+
metadata?: MetadataMap;
|
|
91
|
+
}
|
|
92
|
+
export type RunArtifactKind = "patch" | "branch" | "commit" | "pull_request" | "file" | "report" | "screenshot" | "dataset_row" | "log_bundle" | "summary";
|
|
93
|
+
export interface RunArtifact {
|
|
94
|
+
id: ScoutId;
|
|
95
|
+
runId: ScoutId;
|
|
96
|
+
stepId?: ScoutId;
|
|
97
|
+
kind: RunArtifactKind;
|
|
98
|
+
title: string;
|
|
99
|
+
uri?: string;
|
|
100
|
+
resourceId?: ScoutId;
|
|
101
|
+
contentHash?: string;
|
|
102
|
+
reviewTaskId?: ScoutId;
|
|
103
|
+
createdAt: number;
|
|
104
|
+
createdById?: ScoutId;
|
|
105
|
+
metadata?: MetadataMap;
|
|
106
|
+
}
|
|
107
|
+
export type ReviewTaskKind = "permission" | "output_review" | "promotion" | "retry_decision" | "eval_label" | "handoff";
|
|
108
|
+
export type ReviewTaskState = "open" | "claimed" | "approved" | "rejected" | "dismissed" | "expired";
|
|
109
|
+
export interface ReviewTask {
|
|
110
|
+
id: ScoutId;
|
|
111
|
+
kind: ReviewTaskKind;
|
|
112
|
+
subject: {
|
|
113
|
+
runId?: ScoutId;
|
|
114
|
+
workId?: ScoutId;
|
|
115
|
+
stepId?: ScoutId;
|
|
116
|
+
artifactId?: ScoutId;
|
|
117
|
+
agentRevisionId?: ScoutId;
|
|
118
|
+
promotionId?: ScoutId;
|
|
119
|
+
traceRef?: {
|
|
120
|
+
sessionId: ScoutId;
|
|
121
|
+
turnId?: ScoutId;
|
|
122
|
+
blockId?: ScoutId;
|
|
123
|
+
version?: number;
|
|
124
|
+
};
|
|
125
|
+
};
|
|
126
|
+
assigneeId?: ScoutId;
|
|
127
|
+
groupId?: ScoutId;
|
|
128
|
+
state: ReviewTaskState;
|
|
129
|
+
risk?: "low" | "medium" | "high";
|
|
130
|
+
form?: MetadataMap;
|
|
131
|
+
decision?: MetadataMap;
|
|
132
|
+
createdAt: number;
|
|
133
|
+
claimedAt?: number;
|
|
134
|
+
completedAt?: number;
|
|
135
|
+
metadata?: MetadataMap;
|
|
136
|
+
}
|
|
137
|
+
export interface SavedRunView {
|
|
138
|
+
id: ScoutId;
|
|
139
|
+
name: string;
|
|
140
|
+
ownerId?: ScoutId;
|
|
141
|
+
visibility?: VisibilityScope;
|
|
142
|
+
filters: MetadataMap;
|
|
143
|
+
sort?: Array<{
|
|
144
|
+
field: string;
|
|
145
|
+
direction: "asc" | "desc";
|
|
146
|
+
}>;
|
|
147
|
+
createdAt: number;
|
|
148
|
+
updatedAt: number;
|
|
149
|
+
metadata?: MetadataMap;
|
|
150
|
+
}
|
|
151
|
+
export interface ProjectAgentRunFromInvocationFlightInput {
|
|
152
|
+
invocation: InvocationRequest;
|
|
153
|
+
flight?: FlightRecord;
|
|
154
|
+
now?: number;
|
|
155
|
+
source?: AgentRunSource;
|
|
156
|
+
reviewState?: AgentRunReviewState;
|
|
157
|
+
agentRevisionSnapshot?: AgentRevisionSnapshot;
|
|
158
|
+
reviewTaskIds?: ScoutId[];
|
|
159
|
+
artifactIds?: ScoutId[];
|
|
160
|
+
traceSessionIds?: ScoutId[];
|
|
161
|
+
}
|
|
162
|
+
export interface ProjectAgentRunFromInvocationInput {
|
|
163
|
+
/** The merged invocation record, carrying its own execution status. */
|
|
164
|
+
invocation: Invocation;
|
|
165
|
+
now?: number;
|
|
166
|
+
source?: AgentRunSource;
|
|
167
|
+
reviewState?: AgentRunReviewState;
|
|
168
|
+
agentRevisionSnapshot?: AgentRevisionSnapshot;
|
|
169
|
+
reviewTaskIds?: ScoutId[];
|
|
170
|
+
artifactIds?: ScoutId[];
|
|
171
|
+
traceSessionIds?: ScoutId[];
|
|
172
|
+
}
|
|
173
|
+
export declare function deriveProjectedAgentRunId(input: {
|
|
174
|
+
invocationId: ScoutId;
|
|
175
|
+
flightId?: ScoutId;
|
|
176
|
+
}): ScoutId;
|
|
177
|
+
export declare function projectAgentRunFromInvocationFlight(input: ProjectAgentRunFromInvocationFlightInput): AgentRun;
|
|
178
|
+
/**
|
|
179
|
+
* Project an AgentRun from the merged invocation record (Phase 3's single source
|
|
180
|
+
* of truth), where execution status lives on the invocation itself.
|
|
181
|
+
*
|
|
182
|
+
* Until the storage merge (PR B+) lands, this re-derives the flight view from the
|
|
183
|
+
* invocation's status subset and delegates to
|
|
184
|
+
* {@link projectAgentRunFromInvocationFlight}, so the two projectors stay
|
|
185
|
+
* behavior-identical and the stable `run:flight:<flightId>` id is preserved. A
|
|
186
|
+
* record with no durable flightId projects as an invocation-only run, exactly as
|
|
187
|
+
* the flight-based projector does when no flight is present.
|
|
188
|
+
*/
|
|
189
|
+
export declare function projectAgentRunFromInvocation(input: ProjectAgentRunFromInvocationInput): AgentRun;
|
|
190
|
+
export declare function projectAgentRunState(flightState: FlightRecord["state"] | string | undefined, reviewState?: AgentRunReviewState): AgentRunState;
|
|
191
|
+
//# sourceMappingURL=agent-runs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-runs.d.ts","sourceRoot":"","sources":["../src/agent-runs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACzE,OAAO,KAAK,EACV,YAAY,EACZ,UAAU,EACV,6BAA6B,EAC7B,iBAAiB,EAClB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAEL,KAAK,sBAAsB,EAC5B,MAAM,wBAAwB,CAAC;AAEhC,eAAO,MAAM,gBAAgB,8GAUnB,CAAC;AAEX,MAAM,MAAM,aAAa,GAAG,OAAO,gBAAgB,CAAC,MAAM,CAAC,CAAC;AAE5D,eAAO,MAAM,iBAAiB,kGASpB,CAAC;AAEX,MAAM,MAAM,cAAc,GAAG,OAAO,iBAAiB,CAAC,MAAM,CAAC,CAAC;AAE9D,eAAO,MAAM,uBAAuB,gEAM1B,CAAC;AAEX,MAAM,MAAM,mBAAmB,GAAG,OAAO,uBAAuB,CAAC,MAAM,CAAC,CAAC;AAEzE,MAAM,WAAW,qBAAqB;IACpC,EAAE,CAAC,EAAE,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