@dudousxd/nestjs-agent-core 0.40.0 → 0.42.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -0
- package/dist/ag-ui/index.cjs +46 -10
- package/dist/ag-ui/index.cjs.map +1 -1
- package/dist/ag-ui/index.d.cts +9 -3
- package/dist/ag-ui/index.d.ts +9 -3
- package/dist/ag-ui/index.js +46 -10
- package/dist/ag-ui/index.js.map +1 -1
- package/dist/{catalog-CrzetM3_.d.cts → catalog-BKS3Yxo6.d.cts} +2 -0
- package/dist/{catalog-CrzetM3_.d.ts → catalog-BKS3Yxo6.d.ts} +2 -0
- package/dist/genui/builtins.cjs.map +1 -1
- package/dist/genui/builtins.d.cts +1 -1
- package/dist/genui/builtins.d.ts +1 -1
- package/dist/genui/builtins.js.map +1 -1
- package/dist/genui/index.cjs +660 -68
- package/dist/genui/index.cjs.map +1 -1
- package/dist/genui/index.d.cts +5 -5
- package/dist/genui/index.d.ts +5 -5
- package/dist/genui/index.js +654 -68
- package/dist/genui/index.js.map +1 -1
- package/dist/guardrails/index.cjs +3 -1
- package/dist/guardrails/index.cjs.map +1 -1
- package/dist/guardrails/index.d.cts +5 -4
- package/dist/guardrails/index.d.ts +5 -4
- package/dist/guardrails/index.js +3 -1
- package/dist/guardrails/index.js.map +1 -1
- package/dist/index.cjs +1164 -421
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +124 -13
- package/dist/index.d.ts +124 -13
- package/dist/index.js +1156 -421
- package/dist/index.js.map +1 -1
- package/dist/{processors-BR3nICcp.d.ts → processors-BKILjME5.d.ts} +1 -1
- package/dist/{processors-B7nfbU6E.d.cts → processors-DpHBqRuE.d.cts} +1 -1
- package/dist/{stream-events-M0jc7lSW.d.cts → stream-events-C-pj3bVY.d.cts} +92 -4
- package/dist/{stream-events-DAmes2Of.d.ts → stream-events-D92SgfRk.d.ts} +92 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -528,37 +528,37 @@ async function mayDecideApproval(policy, actor, decision) {
|
|
|
528
528
|
return defaultCanDecide(actor, decision);
|
|
529
529
|
}
|
|
530
530
|
__name(mayDecideApproval, "mayDecideApproval");
|
|
531
|
-
function toolCallApprovalFromRow(
|
|
532
|
-
if (
|
|
531
|
+
function toolCallApprovalFromRow(row2) {
|
|
532
|
+
if (row2.approver === null || row2.approver === void 0) {
|
|
533
533
|
return null;
|
|
534
534
|
}
|
|
535
|
-
const status =
|
|
536
|
-
const expiresAt =
|
|
535
|
+
const status = row2.status === "pending_approval" || row2.status === "proposed" ? "pending" : row2.status === "rejected" ? "rejected" : row2.status === "expired" ? "expired" : "approved";
|
|
536
|
+
const expiresAt = row2.expiresAt instanceof Date ? row2.expiresAt.toISOString() : typeof row2.expiresAt === "string" ? row2.expiresAt : void 0;
|
|
537
537
|
const decided = status === "approved" || status === "rejected";
|
|
538
538
|
return {
|
|
539
|
-
toolCallId:
|
|
540
|
-
...
|
|
541
|
-
proposalId:
|
|
539
|
+
toolCallId: row2.toolCallId,
|
|
540
|
+
...row2.proposalId != null ? {
|
|
541
|
+
proposalId: row2.proposalId
|
|
542
542
|
} : {},
|
|
543
|
-
approver:
|
|
544
|
-
...
|
|
545
|
-
confirmation:
|
|
543
|
+
approver: row2.approver,
|
|
544
|
+
...row2.confirmation != null ? {
|
|
545
|
+
confirmation: row2.confirmation
|
|
546
546
|
} : {},
|
|
547
547
|
status,
|
|
548
548
|
...expiresAt !== void 0 ? {
|
|
549
549
|
expiresAt
|
|
550
550
|
} : {},
|
|
551
|
-
...
|
|
551
|
+
...row2.remember === true ? {
|
|
552
552
|
remember: true
|
|
553
553
|
} : {},
|
|
554
|
-
...decided && typeof
|
|
555
|
-
decidedBy:
|
|
554
|
+
...decided && typeof row2.executedByRef === "string" ? {
|
|
555
|
+
decidedBy: row2.executedByRef
|
|
556
556
|
} : {},
|
|
557
|
-
...decided && typeof
|
|
558
|
-
decidedVia:
|
|
557
|
+
...decided && typeof row2.decidedVia === "string" ? {
|
|
558
|
+
decidedVia: row2.decidedVia
|
|
559
559
|
} : {},
|
|
560
|
-
...status === "rejected" && typeof
|
|
561
|
-
reason:
|
|
560
|
+
...status === "rejected" && typeof row2.error === "string" ? {
|
|
561
|
+
reason: row2.error
|
|
562
562
|
} : {}
|
|
563
563
|
};
|
|
564
564
|
}
|
|
@@ -575,24 +575,24 @@ function estimateCost(usage, price) {
|
|
|
575
575
|
return uncachedInputTokens / 1e6 * price.inputPricePer1m + cacheWriteTokens / 1e6 * (price.cacheWritePricePer1m ?? price.inputPricePer1m) + cacheReadTokens / 1e6 * (price.cacheReadPricePer1m ?? price.inputPricePer1m) + usage.outputTokens / 1e6 * price.outputPricePer1m;
|
|
576
576
|
}
|
|
577
577
|
__name(estimateCost, "estimateCost");
|
|
578
|
-
function rowCost(
|
|
579
|
-
return
|
|
578
|
+
function rowCost(row2, prices) {
|
|
579
|
+
return row2.costUsd ?? estimateCost(row2, prices.get(row2.modelId));
|
|
580
580
|
}
|
|
581
581
|
__name(rowCost, "rowCost");
|
|
582
582
|
function bucketByModel(rows, prices) {
|
|
583
583
|
const byModel = /* @__PURE__ */ new Map();
|
|
584
|
-
for (const
|
|
585
|
-
const bucket = byModel.get(
|
|
584
|
+
for (const row2 of rows) {
|
|
585
|
+
const bucket = byModel.get(row2.modelId) ?? {
|
|
586
586
|
requests: 0,
|
|
587
587
|
inputTokens: 0,
|
|
588
588
|
outputTokens: 0,
|
|
589
589
|
costUsd: 0
|
|
590
590
|
};
|
|
591
591
|
bucket.requests += 1;
|
|
592
|
-
bucket.inputTokens +=
|
|
593
|
-
bucket.outputTokens +=
|
|
594
|
-
bucket.costUsd += rowCost(
|
|
595
|
-
byModel.set(
|
|
592
|
+
bucket.inputTokens += row2.inputTokens;
|
|
593
|
+
bucket.outputTokens += row2.outputTokens;
|
|
594
|
+
bucket.costUsd += rowCost(row2, prices);
|
|
595
|
+
byModel.set(row2.modelId, bucket);
|
|
596
596
|
}
|
|
597
597
|
const result2 = [];
|
|
598
598
|
for (const [modelId, bucket] of byModel) {
|
|
@@ -610,18 +610,18 @@ function bucketByModel(rows, prices) {
|
|
|
610
610
|
__name(bucketByModel, "bucketByModel");
|
|
611
611
|
function bucketByActor(rows, prices) {
|
|
612
612
|
const byActor = /* @__PURE__ */ new Map();
|
|
613
|
-
for (const
|
|
614
|
-
const bucket = byActor.get(
|
|
613
|
+
for (const row2 of rows) {
|
|
614
|
+
const bucket = byActor.get(row2.actorRef) ?? {
|
|
615
615
|
requests: 0,
|
|
616
616
|
totalTokens: 0,
|
|
617
617
|
costUsd: 0,
|
|
618
618
|
threadIds: /* @__PURE__ */ new Set()
|
|
619
619
|
};
|
|
620
620
|
bucket.requests += 1;
|
|
621
|
-
bucket.totalTokens +=
|
|
622
|
-
bucket.costUsd += rowCost(
|
|
623
|
-
bucket.threadIds.add(
|
|
624
|
-
byActor.set(
|
|
621
|
+
bucket.totalTokens += row2.inputTokens + row2.outputTokens;
|
|
622
|
+
bucket.costUsd += rowCost(row2, prices);
|
|
623
|
+
bucket.threadIds.add(row2.threadId);
|
|
624
|
+
byActor.set(row2.actorRef, bucket);
|
|
625
625
|
}
|
|
626
626
|
const result2 = [];
|
|
627
627
|
for (const [actorRef, bucket] of byActor) {
|
|
@@ -639,16 +639,16 @@ function bucketByActor(rows, prices) {
|
|
|
639
639
|
__name(bucketByActor, "bucketByActor");
|
|
640
640
|
function bucketByThread(rows, prices, threads, options) {
|
|
641
641
|
const byThread = /* @__PURE__ */ new Map();
|
|
642
|
-
for (const
|
|
643
|
-
const bucket = byThread.get(
|
|
642
|
+
for (const row2 of rows) {
|
|
643
|
+
const bucket = byThread.get(row2.threadId) ?? {
|
|
644
644
|
requests: 0,
|
|
645
645
|
totalTokens: 0,
|
|
646
646
|
costUsd: 0
|
|
647
647
|
};
|
|
648
648
|
bucket.requests += 1;
|
|
649
|
-
bucket.totalTokens +=
|
|
650
|
-
bucket.costUsd += rowCost(
|
|
651
|
-
byThread.set(
|
|
649
|
+
bucket.totalTokens += row2.inputTokens + row2.outputTokens;
|
|
650
|
+
bucket.costUsd += rowCost(row2, prices);
|
|
651
|
+
byThread.set(row2.threadId, bucket);
|
|
652
652
|
}
|
|
653
653
|
const result2 = [];
|
|
654
654
|
for (const [threadId, bucket] of byThread) {
|
|
@@ -677,26 +677,26 @@ function rollupThreadUsage(rows, prices) {
|
|
|
677
677
|
totalTokens: 0,
|
|
678
678
|
costUsd: 0
|
|
679
679
|
};
|
|
680
|
-
for (const
|
|
680
|
+
for (const row2 of rows) {
|
|
681
681
|
rollup.requests += 1;
|
|
682
|
-
rollup.inputTokens +=
|
|
683
|
-
rollup.outputTokens +=
|
|
684
|
-
rollup.totalTokens +=
|
|
685
|
-
rollup.costUsd += rowCost(
|
|
682
|
+
rollup.inputTokens += row2.inputTokens;
|
|
683
|
+
rollup.outputTokens += row2.outputTokens;
|
|
684
|
+
rollup.totalTokens += row2.inputTokens + row2.outputTokens;
|
|
685
|
+
rollup.costUsd += rowCost(row2, prices);
|
|
686
686
|
}
|
|
687
687
|
return rollup;
|
|
688
688
|
}
|
|
689
689
|
__name(rollupThreadUsage, "rollupThreadUsage");
|
|
690
690
|
function bucketUsageTrend(rows, prices) {
|
|
691
691
|
const byDay = /* @__PURE__ */ new Map();
|
|
692
|
-
for (const
|
|
693
|
-
const bucket = byDay.get(
|
|
692
|
+
for (const row2 of rows) {
|
|
693
|
+
const bucket = byDay.get(row2.day) ?? {
|
|
694
694
|
totalTokens: 0,
|
|
695
695
|
costUsd: 0
|
|
696
696
|
};
|
|
697
|
-
bucket.totalTokens +=
|
|
698
|
-
bucket.costUsd += rowCost(
|
|
699
|
-
byDay.set(
|
|
697
|
+
bucket.totalTokens += row2.inputTokens + row2.outputTokens;
|
|
698
|
+
bucket.costUsd += rowCost(row2, prices);
|
|
699
|
+
byDay.set(row2.day, bucket);
|
|
700
700
|
}
|
|
701
701
|
const result2 = [];
|
|
702
702
|
for (const [day, bucket] of byDay) {
|
|
@@ -732,7 +732,7 @@ async function filterToolsByEnabled(entries) {
|
|
|
732
732
|
entry,
|
|
733
733
|
enabled: await isToolEnabled(entry.spec, entry.handler)
|
|
734
734
|
})));
|
|
735
|
-
return checked.filter((
|
|
735
|
+
return checked.filter((row2) => row2.enabled).map((row2) => row2.entry);
|
|
736
736
|
}
|
|
737
737
|
__name(filterToolsByEnabled, "filterToolsByEnabled");
|
|
738
738
|
async function canActorUseTool(actor, handler) {
|
|
@@ -744,7 +744,7 @@ async function filterToolsByCanUse(entries, actor) {
|
|
|
744
744
|
entry,
|
|
745
745
|
allowed: await canActorUseTool(actor, entry.handler)
|
|
746
746
|
})));
|
|
747
|
-
return checked.filter((
|
|
747
|
+
return checked.filter((row2) => row2.allowed).map((row2) => row2.entry);
|
|
748
748
|
}
|
|
749
749
|
__name(filterToolsByCanUse, "filterToolsByCanUse");
|
|
750
750
|
async function filterToolsByRole(tools, actor, policy) {
|
|
@@ -2644,20 +2644,20 @@ function validateActionProposalDiscoveryIndexBatch(command) {
|
|
|
2644
2644
|
__name(validateActionProposalDiscoveryIndexBatch, "validateActionProposalDiscoveryIndexBatch");
|
|
2645
2645
|
|
|
2646
2646
|
// src/action-proposal-outcome.ts
|
|
2647
|
-
function attachActionProposalOutcome(
|
|
2648
|
-
if (
|
|
2649
|
-
const execution =
|
|
2647
|
+
function attachActionProposalOutcome(row2, now, ui = [], text) {
|
|
2648
|
+
if (row2.outcome) return row2;
|
|
2649
|
+
const execution = row2.execution;
|
|
2650
2650
|
const outcome = {
|
|
2651
|
-
id: `${
|
|
2652
|
-
proposalId:
|
|
2651
|
+
id: `${row2.id}:outcome:1`,
|
|
2652
|
+
proposalId: row2.id,
|
|
2653
2653
|
outcomeVersion: 1,
|
|
2654
|
-
tenantRef:
|
|
2655
|
-
actorRef:
|
|
2656
|
-
threadId:
|
|
2657
|
-
originRunId:
|
|
2658
|
-
originToolCallId:
|
|
2659
|
-
toolName:
|
|
2660
|
-
decision:
|
|
2654
|
+
tenantRef: row2.tenantRef,
|
|
2655
|
+
actorRef: row2.actorRef,
|
|
2656
|
+
threadId: row2.threadId,
|
|
2657
|
+
originRunId: row2.originRunId,
|
|
2658
|
+
originToolCallId: row2.originToolCallId,
|
|
2659
|
+
toolName: row2.toolName,
|
|
2660
|
+
decision: row2.decision,
|
|
2661
2661
|
ui,
|
|
2662
2662
|
createdAt: now,
|
|
2663
2663
|
...text !== void 0 ? {
|
|
@@ -2671,12 +2671,12 @@ function attachActionProposalOutcome(row, now, ui = [], text) {
|
|
|
2671
2671
|
} : {},
|
|
2672
2672
|
...execution?.error !== void 0 ? {
|
|
2673
2673
|
error: execution.error
|
|
2674
|
-
} :
|
|
2675
|
-
error:
|
|
2674
|
+
} : row2.decisionAudit?.reason !== void 0 ? {
|
|
2675
|
+
error: row2.decisionAudit.reason
|
|
2676
2676
|
} : {}
|
|
2677
2677
|
};
|
|
2678
2678
|
return snapshotActionProposal({
|
|
2679
|
-
...
|
|
2679
|
+
...row2,
|
|
2680
2680
|
outcome,
|
|
2681
2681
|
outcomeDelivery: {
|
|
2682
2682
|
status: "pending",
|
|
@@ -2686,13 +2686,13 @@ function attachActionProposalOutcome(row, now, ui = [], text) {
|
|
|
2686
2686
|
});
|
|
2687
2687
|
}
|
|
2688
2688
|
__name(attachActionProposalOutcome, "attachActionProposalOutcome");
|
|
2689
|
-
function claimActionProposalOutcome(
|
|
2689
|
+
function claimActionProposalOutcome(row2, command, now, token) {
|
|
2690
2690
|
validateActionProposalWorkerClaim(command, now);
|
|
2691
|
-
const delivery =
|
|
2692
|
-
if (!
|
|
2691
|
+
const delivery = row2.outcomeDelivery;
|
|
2692
|
+
if (!row2.outcome || !delivery || delivery.status !== "pending" || delivery.lease && now < delivery.lease.expiresAt) return null;
|
|
2693
2693
|
const generation = delivery.generation + 1;
|
|
2694
2694
|
return snapshotActionProposal({
|
|
2695
|
-
...
|
|
2695
|
+
...row2,
|
|
2696
2696
|
outcomeDelivery: {
|
|
2697
2697
|
...delivery,
|
|
2698
2698
|
generation,
|
|
@@ -2706,11 +2706,11 @@ function claimActionProposalOutcome(row, command, now, token) {
|
|
|
2706
2706
|
});
|
|
2707
2707
|
}
|
|
2708
2708
|
__name(claimActionProposalOutcome, "claimActionProposalOutcome");
|
|
2709
|
-
function actionProposalOutcomeFenceValid(
|
|
2709
|
+
function actionProposalOutcomeFenceValid(row2, command, now) {
|
|
2710
2710
|
if (!Number.isSafeInteger(now)) throw new RangeError("Invalid server clock");
|
|
2711
2711
|
if (typeof command.token !== "string" || !command.token || !Number.isSafeInteger(command.generation) || command.generation < 1 || typeof command.outcomeId !== "string" || !command.outcomeId) throw new TypeError("Invalid outcome fence");
|
|
2712
|
-
const delivery =
|
|
2713
|
-
return
|
|
2712
|
+
const delivery = row2.outcomeDelivery;
|
|
2713
|
+
return row2.outcome?.id === command.outcomeId && delivery?.status === "pending" && delivery.generation === command.generation && delivery.lease?.token === command.token && delivery.lease.generation === command.generation && now < delivery.lease.expiresAt;
|
|
2714
2714
|
}
|
|
2715
2715
|
__name(actionProposalOutcomeFenceValid, "actionProposalOutcomeFenceValid");
|
|
2716
2716
|
function outcomeSummary(outcome) {
|
|
@@ -2885,21 +2885,21 @@ function check(schema, value, path, root, issues, depth) {
|
|
|
2885
2885
|
});
|
|
2886
2886
|
return;
|
|
2887
2887
|
}
|
|
2888
|
-
const
|
|
2889
|
-
if (typeof
|
|
2890
|
-
const target = resolveRef(root,
|
|
2888
|
+
const s2 = schema;
|
|
2889
|
+
if (typeof s2.$ref === "string") {
|
|
2890
|
+
const target = resolveRef(root, s2.$ref);
|
|
2891
2891
|
if (target === void 0) {
|
|
2892
2892
|
issues.push({
|
|
2893
2893
|
path,
|
|
2894
|
-
message: `references unknown schema ${
|
|
2894
|
+
message: `references unknown schema ${s2.$ref}`
|
|
2895
2895
|
});
|
|
2896
2896
|
return;
|
|
2897
2897
|
}
|
|
2898
2898
|
check(target, value, path, root, issues, depth + 1);
|
|
2899
2899
|
}
|
|
2900
|
-
if (
|
|
2901
|
-
const types = Array.isArray(
|
|
2902
|
-
|
|
2900
|
+
if (s2.type !== void 0) {
|
|
2901
|
+
const types = Array.isArray(s2.type) ? s2.type : [
|
|
2902
|
+
s2.type
|
|
2903
2903
|
];
|
|
2904
2904
|
if (!types.some((type) => matchesType(type, value))) {
|
|
2905
2905
|
issues.push({
|
|
@@ -2909,76 +2909,76 @@ function check(schema, value, path, root, issues, depth) {
|
|
|
2909
2909
|
return;
|
|
2910
2910
|
}
|
|
2911
2911
|
}
|
|
2912
|
-
if (Array.isArray(
|
|
2912
|
+
if (Array.isArray(s2.enum) && !s2.enum.some((option) => deepEqual(option, value))) {
|
|
2913
2913
|
issues.push({
|
|
2914
2914
|
path,
|
|
2915
|
-
message: `must be one of ${
|
|
2915
|
+
message: `must be one of ${s2.enum.map((option) => JSON.stringify(option)).join(", ")}`
|
|
2916
2916
|
});
|
|
2917
2917
|
}
|
|
2918
|
-
if ("const" in
|
|
2918
|
+
if ("const" in s2 && !deepEqual(s2.const, value)) {
|
|
2919
2919
|
issues.push({
|
|
2920
2920
|
path,
|
|
2921
|
-
message: `must be ${JSON.stringify(
|
|
2921
|
+
message: `must be ${JSON.stringify(s2.const)}`
|
|
2922
2922
|
});
|
|
2923
2923
|
}
|
|
2924
2924
|
if (typeof value === "string") {
|
|
2925
|
-
if (typeof
|
|
2925
|
+
if (typeof s2.minLength === "number" && value.length < s2.minLength) {
|
|
2926
2926
|
issues.push({
|
|
2927
2927
|
path,
|
|
2928
|
-
message: `must be at least ${
|
|
2928
|
+
message: `must be at least ${s2.minLength} characters`
|
|
2929
2929
|
});
|
|
2930
2930
|
}
|
|
2931
|
-
if (typeof
|
|
2931
|
+
if (typeof s2.maxLength === "number" && value.length > s2.maxLength) {
|
|
2932
2932
|
issues.push({
|
|
2933
2933
|
path,
|
|
2934
|
-
message: `must be at most ${
|
|
2934
|
+
message: `must be at most ${s2.maxLength} characters`
|
|
2935
2935
|
});
|
|
2936
2936
|
}
|
|
2937
|
-
if (typeof
|
|
2937
|
+
if (typeof s2.pattern === "string") {
|
|
2938
2938
|
let pattern;
|
|
2939
2939
|
try {
|
|
2940
|
-
pattern = new RegExp(
|
|
2940
|
+
pattern = new RegExp(s2.pattern, "u");
|
|
2941
2941
|
} catch {
|
|
2942
2942
|
pattern = void 0;
|
|
2943
2943
|
}
|
|
2944
2944
|
if (pattern !== void 0 && !pattern.test(value)) {
|
|
2945
2945
|
issues.push({
|
|
2946
2946
|
path,
|
|
2947
|
-
message: `must match ${
|
|
2947
|
+
message: `must match ${s2.pattern}`
|
|
2948
2948
|
});
|
|
2949
2949
|
}
|
|
2950
2950
|
}
|
|
2951
2951
|
}
|
|
2952
2952
|
if (typeof value === "number") {
|
|
2953
|
-
if (typeof
|
|
2953
|
+
if (typeof s2.minimum === "number" && value < s2.minimum) {
|
|
2954
2954
|
issues.push({
|
|
2955
2955
|
path,
|
|
2956
|
-
message: `must be >= ${
|
|
2956
|
+
message: `must be >= ${s2.minimum}`
|
|
2957
2957
|
});
|
|
2958
2958
|
}
|
|
2959
|
-
if (typeof
|
|
2959
|
+
if (typeof s2.maximum === "number" && value > s2.maximum) {
|
|
2960
2960
|
issues.push({
|
|
2961
2961
|
path,
|
|
2962
|
-
message: `must be <= ${
|
|
2962
|
+
message: `must be <= ${s2.maximum}`
|
|
2963
2963
|
});
|
|
2964
2964
|
}
|
|
2965
2965
|
}
|
|
2966
2966
|
if (Array.isArray(value)) {
|
|
2967
|
-
if (typeof
|
|
2967
|
+
if (typeof s2.minItems === "number" && value.length < s2.minItems) {
|
|
2968
2968
|
issues.push({
|
|
2969
2969
|
path,
|
|
2970
|
-
message: `must have at least ${
|
|
2970
|
+
message: `must have at least ${s2.minItems} items`
|
|
2971
2971
|
});
|
|
2972
2972
|
}
|
|
2973
|
-
if (typeof
|
|
2973
|
+
if (typeof s2.maxItems === "number" && value.length > s2.maxItems) {
|
|
2974
2974
|
issues.push({
|
|
2975
2975
|
path,
|
|
2976
|
-
message: `must have at most ${
|
|
2976
|
+
message: `must have at most ${s2.maxItems} items`
|
|
2977
2977
|
});
|
|
2978
2978
|
}
|
|
2979
|
-
if (
|
|
2979
|
+
if (s2.items !== void 0 && !Array.isArray(s2.items)) {
|
|
2980
2980
|
value.forEach((item, index) => {
|
|
2981
|
-
check(
|
|
2981
|
+
check(s2.items, item, [
|
|
2982
2982
|
...path,
|
|
2983
2983
|
index
|
|
2984
2984
|
], root, issues, depth + 1);
|
|
@@ -2987,9 +2987,9 @@ function check(schema, value, path, root, issues, depth) {
|
|
|
2987
2987
|
}
|
|
2988
2988
|
if (matchesType("object", value)) {
|
|
2989
2989
|
const record2 = value;
|
|
2990
|
-
const properties = typeof
|
|
2991
|
-
if (Array.isArray(
|
|
2992
|
-
for (const key of
|
|
2990
|
+
const properties = typeof s2.properties === "object" && s2.properties !== null ? s2.properties : {};
|
|
2991
|
+
if (Array.isArray(s2.required)) {
|
|
2992
|
+
for (const key of s2.required) {
|
|
2993
2993
|
if (record2[key] === void 0) {
|
|
2994
2994
|
issues.push({
|
|
2995
2995
|
path: [
|
|
@@ -3009,7 +3009,7 @@ function check(schema, value, path, root, issues, depth) {
|
|
|
3009
3009
|
key
|
|
3010
3010
|
], root, issues, depth + 1);
|
|
3011
3011
|
}
|
|
3012
|
-
} else if (
|
|
3012
|
+
} else if (s2.additionalProperties === false) {
|
|
3013
3013
|
issues.push({
|
|
3014
3014
|
path: [
|
|
3015
3015
|
...path,
|
|
@@ -3017,34 +3017,34 @@ function check(schema, value, path, root, issues, depth) {
|
|
|
3017
3017
|
],
|
|
3018
3018
|
message: "is not a known property"
|
|
3019
3019
|
});
|
|
3020
|
-
} else if (typeof
|
|
3021
|
-
check(
|
|
3020
|
+
} else if (typeof s2.additionalProperties === "object" && s2.additionalProperties !== null) {
|
|
3021
|
+
check(s2.additionalProperties, entry, [
|
|
3022
3022
|
...path,
|
|
3023
3023
|
key
|
|
3024
3024
|
], root, issues, depth + 1);
|
|
3025
3025
|
}
|
|
3026
3026
|
}
|
|
3027
3027
|
}
|
|
3028
|
-
if (Array.isArray(
|
|
3029
|
-
for (const sub of
|
|
3028
|
+
if (Array.isArray(s2.allOf)) {
|
|
3029
|
+
for (const sub of s2.allOf) check(sub, value, path, root, issues, depth + 1);
|
|
3030
3030
|
}
|
|
3031
|
-
if (Array.isArray(
|
|
3032
|
-
const options = Array.isArray(
|
|
3031
|
+
if (Array.isArray(s2.anyOf) || Array.isArray(s2.oneOf)) {
|
|
3032
|
+
const options = Array.isArray(s2.anyOf) ? s2.anyOf : s2.oneOf;
|
|
3033
3033
|
const passing = options.filter((sub) => {
|
|
3034
3034
|
const nested = [];
|
|
3035
3035
|
check(sub, value, path, root, nested, depth + 1);
|
|
3036
3036
|
return nested.length === 0;
|
|
3037
3037
|
}).length;
|
|
3038
|
-
if (Array.isArray(
|
|
3038
|
+
if (Array.isArray(s2.anyOf) ? passing === 0 : passing !== 1) {
|
|
3039
3039
|
issues.push({
|
|
3040
3040
|
path,
|
|
3041
|
-
message: Array.isArray(
|
|
3041
|
+
message: Array.isArray(s2.anyOf) ? "does not match any allowed shape" : "must match exactly one allowed shape"
|
|
3042
3042
|
});
|
|
3043
3043
|
}
|
|
3044
3044
|
}
|
|
3045
|
-
if (
|
|
3045
|
+
if (s2.not !== void 0) {
|
|
3046
3046
|
const nested = [];
|
|
3047
|
-
check(
|
|
3047
|
+
check(s2.not, value, path, root, nested, depth + 1);
|
|
3048
3048
|
if (nested.length === 0) {
|
|
3049
3049
|
issues.push({
|
|
3050
3050
|
path,
|
|
@@ -3101,7 +3101,7 @@ function buildCatalog(byName, validator) {
|
|
|
3101
3101
|
]
|
|
3102
3102
|
};
|
|
3103
3103
|
}
|
|
3104
|
-
const result2 = await validateProps(definition.props, props, validator);
|
|
3104
|
+
const result2 = await validateProps(definition.outputProps ?? definition.props, props, validator);
|
|
3105
3105
|
return result2;
|
|
3106
3106
|
},
|
|
3107
3107
|
validateSync(component, props) {
|
|
@@ -3117,11 +3117,11 @@ function buildCatalog(byName, validator) {
|
|
|
3117
3117
|
]
|
|
3118
3118
|
};
|
|
3119
3119
|
}
|
|
3120
|
-
return validatePropsSync(definition.props, props, validator);
|
|
3120
|
+
return validatePropsSync(definition.outputProps ?? definition.props, props, validator);
|
|
3121
3121
|
},
|
|
3122
3122
|
jsonSchemaFor(component) {
|
|
3123
3123
|
const definition = byName.get(component);
|
|
3124
|
-
return definition === void 0 ? void 0 : toJsonSchema(definition.props);
|
|
3124
|
+
return definition === void 0 ? void 0 : toJsonSchema(definition.outputProps ?? definition.props);
|
|
3125
3125
|
},
|
|
3126
3126
|
extend(more) {
|
|
3127
3127
|
const next = new Map(byName);
|
|
@@ -3137,7 +3137,7 @@ __name(buildCatalog, "buildCatalog");
|
|
|
3137
3137
|
|
|
3138
3138
|
// src/genui/tree.ts
|
|
3139
3139
|
var GENUI_TREE_COMPONENT = "genui:tree";
|
|
3140
|
-
async function validateTree(catalog, tree, limits = {}) {
|
|
3140
|
+
async function validateTree(catalog, tree, limits = {}, phase = "output") {
|
|
3141
3141
|
const maxDepth = limits.maxDepth ?? 12;
|
|
3142
3142
|
const maxNodes = limits.maxNodes ?? 200;
|
|
3143
3143
|
const issues = [];
|
|
@@ -3189,7 +3189,7 @@ async function validateTree(catalog, tree, limits = {}) {
|
|
|
3189
3189
|
});
|
|
3190
3190
|
return void 0;
|
|
3191
3191
|
}
|
|
3192
|
-
const validated = await catalog.validate(element.type, element.props ?? {});
|
|
3192
|
+
const validated = phase === "input" ? await validateProps(definition.props, element.props ?? {}, catalog.validator) : await catalog.validate(element.type, element.props ?? {});
|
|
3193
3193
|
let props = {};
|
|
3194
3194
|
if (!validated.ok) {
|
|
3195
3195
|
for (const issue4 of validated.issues) {
|
|
@@ -3549,8 +3549,8 @@ function snapshotActionProposal(value) {
|
|
|
3549
3549
|
return JSON.parse(canonicalActionProposalJson(value));
|
|
3550
3550
|
}
|
|
3551
3551
|
__name(snapshotActionProposal, "snapshotActionProposal");
|
|
3552
|
-
function actionProposalScopeMatches(
|
|
3553
|
-
return
|
|
3552
|
+
function actionProposalScopeMatches(row2, scope) {
|
|
3553
|
+
return row2.tenantRef === scope.tenantRef && row2.actorRef === scope.actorRef && row2.threadId === scope.threadId;
|
|
3554
3554
|
}
|
|
3555
3555
|
__name(actionProposalScopeMatches, "actionProposalScopeMatches");
|
|
3556
3556
|
function initialActionProposal(input, now) {
|
|
@@ -3566,9 +3566,9 @@ function initialActionProposal(input, now) {
|
|
|
3566
3566
|
});
|
|
3567
3567
|
}
|
|
3568
3568
|
__name(initialActionProposal, "initialActionProposal");
|
|
3569
|
-
function actionProposalCreationMatches(
|
|
3569
|
+
function actionProposalCreationMatches(row2, input) {
|
|
3570
3570
|
validateActionProposalCreation(input);
|
|
3571
|
-
const { decision: _decision, decisionAudit: _audit, execution: _execution, createdAt: _created, updatedAt: _updated, supersededBy: _supersededBy, outcome: _outcome, outcomeDelivery: _delivery, ...original } =
|
|
3571
|
+
const { decision: _decision, decisionAudit: _audit, execution: _execution, createdAt: _created, updatedAt: _updated, supersededBy: _supersededBy, outcome: _outcome, outcomeDelivery: _delivery, ...original } = row2;
|
|
3572
3572
|
return canonicalActionProposalJson(original) === canonicalActionProposalJson(input);
|
|
3573
3573
|
}
|
|
3574
3574
|
__name(actionProposalCreationMatches, "actionProposalCreationMatches");
|
|
@@ -3579,7 +3579,7 @@ function result(status, proposal) {
|
|
|
3579
3579
|
};
|
|
3580
3580
|
}
|
|
3581
3581
|
__name(result, "result");
|
|
3582
|
-
function transitionActionProposalDecision(
|
|
3582
|
+
function transitionActionProposalDecision(row2, command, now) {
|
|
3583
3583
|
checkTime(now);
|
|
3584
3584
|
if (![
|
|
3585
3585
|
"approved",
|
|
@@ -3590,11 +3590,11 @@ function transitionActionProposalDecision(row, command, now) {
|
|
|
3590
3590
|
checkString(command.via);
|
|
3591
3591
|
if (command.reason !== void 0 && typeof command.reason !== "string") throw new TypeError("reason must be a string");
|
|
3592
3592
|
if (command.remember !== void 0 && typeof command.remember !== "boolean") throw new TypeError("remember must be a boolean");
|
|
3593
|
-
if (
|
|
3594
|
-
return result(
|
|
3593
|
+
if (row2.decision !== "pending") {
|
|
3594
|
+
return result(row2.decision === command.decision ? "unchanged" : row2.decision === "expired" ? "expired" : "conflict", row2);
|
|
3595
3595
|
}
|
|
3596
|
-
const next = snapshotActionProposal(
|
|
3597
|
-
if (
|
|
3596
|
+
const next = snapshotActionProposal(row2);
|
|
3597
|
+
if (row2.expiresAt !== null && now >= row2.expiresAt) {
|
|
3598
3598
|
next.decision = "expired";
|
|
3599
3599
|
next.decisionAudit = {
|
|
3600
3600
|
actorRef: "system",
|
|
@@ -3604,7 +3604,7 @@ function transitionActionProposalDecision(row, command, now) {
|
|
|
3604
3604
|
next.updatedAt = now;
|
|
3605
3605
|
return result(command.decision === "expired" ? "applied" : "expired", attachActionProposalOutcome(next, now));
|
|
3606
3606
|
}
|
|
3607
|
-
if (command.decision === "expired") return result("conflict",
|
|
3607
|
+
if (command.decision === "expired") return result("conflict", row2);
|
|
3608
3608
|
const { decision, ...audit } = command;
|
|
3609
3609
|
next.decision = decision;
|
|
3610
3610
|
next.decisionAudit = {
|
|
@@ -3632,13 +3632,13 @@ function checkLeaseMs(leaseMs, now) {
|
|
|
3632
3632
|
if (!Number.isSafeInteger(leaseMs) || leaseMs <= 0 || !Number.isSafeInteger(now + leaseMs)) throw new RangeError("leaseMs must be finite and positive");
|
|
3633
3633
|
}
|
|
3634
3634
|
__name(checkLeaseMs, "checkLeaseMs");
|
|
3635
|
-
function transitionActionProposalClaim(
|
|
3635
|
+
function transitionActionProposalClaim(row2, command, now, token) {
|
|
3636
3636
|
checkLeaseMs(command.leaseMs, now);
|
|
3637
3637
|
checkString(command.workerId);
|
|
3638
3638
|
checkString(token);
|
|
3639
|
-
const execution =
|
|
3640
|
-
if (
|
|
3641
|
-
const next = snapshotActionProposal(
|
|
3639
|
+
const execution = row2.execution;
|
|
3640
|
+
if (row2.decision !== "approved" || !execution || execution.status !== "queued" && !(execution.status === "executing" && execution.lease && now >= execution.lease.expiresAt)) return result("conflict", row2);
|
|
3641
|
+
const next = snapshotActionProposal(row2);
|
|
3642
3642
|
const generation = execution.generation + 1;
|
|
3643
3643
|
next.execution = {
|
|
3644
3644
|
status: "executing",
|
|
@@ -3654,32 +3654,32 @@ function transitionActionProposalClaim(row, command, now, token) {
|
|
|
3654
3654
|
return result("applied", next);
|
|
3655
3655
|
}
|
|
3656
3656
|
__name(transitionActionProposalClaim, "transitionActionProposalClaim");
|
|
3657
|
-
function leaseStatus(
|
|
3657
|
+
function leaseStatus(row2, command, now) {
|
|
3658
3658
|
checkTime(now);
|
|
3659
3659
|
checkString(command.token);
|
|
3660
3660
|
if (!Number.isSafeInteger(command.generation) || command.generation < 1) throw new RangeError("Invalid lease generation");
|
|
3661
|
-
const work =
|
|
3662
|
-
if (
|
|
3661
|
+
const work = row2.execution;
|
|
3662
|
+
if (row2.decision !== "approved" || work?.status !== "executing" || !work.lease || work.generation !== command.generation || work.lease.generation !== command.generation || work.lease.token !== command.token) return "conflict";
|
|
3663
3663
|
return now >= work.lease.expiresAt ? "expired" : "valid";
|
|
3664
3664
|
}
|
|
3665
3665
|
__name(leaseStatus, "leaseStatus");
|
|
3666
|
-
function transitionActionProposalLease(
|
|
3666
|
+
function transitionActionProposalLease(row2, command, now) {
|
|
3667
3667
|
checkLeaseMs(command.leaseMs, now);
|
|
3668
|
-
const status = leaseStatus(
|
|
3669
|
-
if (status !== "valid") return result(status,
|
|
3670
|
-
const next = snapshotActionProposal(
|
|
3668
|
+
const status = leaseStatus(row2, command, now);
|
|
3669
|
+
if (status !== "valid") return result(status, row2);
|
|
3670
|
+
const next = snapshotActionProposal(row2);
|
|
3671
3671
|
if (next.execution?.lease) next.execution.lease.expiresAt = Math.max(next.execution.lease.expiresAt, now + command.leaseMs);
|
|
3672
3672
|
next.updatedAt = now;
|
|
3673
3673
|
return result("applied", next);
|
|
3674
3674
|
}
|
|
3675
3675
|
__name(transitionActionProposalLease, "transitionActionProposalLease");
|
|
3676
|
-
function transitionActionProposalSettlement(
|
|
3676
|
+
function transitionActionProposalSettlement(row2, command, now) {
|
|
3677
3677
|
checkTime(now);
|
|
3678
3678
|
if (command.status !== "succeeded" && command.status !== "failed") throw new TypeError("Unsupported settlement status");
|
|
3679
3679
|
if (command.status === "succeeded" && command.error !== void 0 || command.status === "failed" && (typeof command.error !== "string" || command.result !== void 0)) throw new TypeError("Ambiguous action proposal settlement");
|
|
3680
|
-
const status = leaseStatus(
|
|
3681
|
-
if (status !== "valid") return result(status,
|
|
3682
|
-
const next = snapshotActionProposal(
|
|
3680
|
+
const status = leaseStatus(row2, command, now);
|
|
3681
|
+
if (status !== "valid") return result(status, row2);
|
|
3682
|
+
const next = snapshotActionProposal(row2);
|
|
3683
3683
|
next.execution = command.status === "succeeded" ? {
|
|
3684
3684
|
status: "succeeded",
|
|
3685
3685
|
generation: command.generation,
|
|
@@ -3699,16 +3699,16 @@ function transitionActionProposalSettlement(row, command, now) {
|
|
|
3699
3699
|
return result("applied", attachActionProposalOutcome(next, now, command.ui, command.text));
|
|
3700
3700
|
}
|
|
3701
3701
|
__name(transitionActionProposalSettlement, "transitionActionProposalSettlement");
|
|
3702
|
-
function transitionActionProposalSupersession(
|
|
3702
|
+
function transitionActionProposalSupersession(row2, replacement, command, now) {
|
|
3703
3703
|
checkTime(now);
|
|
3704
3704
|
checkString(command.replacementProposalId);
|
|
3705
3705
|
checkString(command.actorRef);
|
|
3706
3706
|
checkString(command.via);
|
|
3707
|
-
if (replacement.id !== command.replacementProposalId ||
|
|
3708
|
-
if (
|
|
3709
|
-
if (
|
|
3710
|
-
if (
|
|
3711
|
-
...transitionActionProposalDecision(
|
|
3707
|
+
if (replacement.id !== command.replacementProposalId || row2.id === replacement.id || !actionProposalScopeMatches(row2, replacement) || row2.toolName !== replacement.toolName || !row2.replacementKey || row2.replacementKey !== replacement.replacementKey) return result("conflict", row2);
|
|
3708
|
+
if (row2.decision === "superseded") return result(row2.supersededBy === replacement.id ? "unchanged" : "conflict", row2);
|
|
3709
|
+
if (row2.decision !== "pending") return result("conflict", row2);
|
|
3710
|
+
if (row2.expiresAt !== null && now >= row2.expiresAt) return {
|
|
3711
|
+
...transitionActionProposalDecision(row2, {
|
|
3712
3712
|
decision: "expired",
|
|
3713
3713
|
actorRef: "system",
|
|
3714
3714
|
via: "expiry"
|
|
@@ -3716,7 +3716,7 @@ function transitionActionProposalSupersession(row, replacement, command, now) {
|
|
|
3716
3716
|
status: "expired"
|
|
3717
3717
|
};
|
|
3718
3718
|
const next = snapshotActionProposal({
|
|
3719
|
-
...
|
|
3719
|
+
...row2,
|
|
3720
3720
|
decision: "superseded",
|
|
3721
3721
|
supersededBy: replacement.id,
|
|
3722
3722
|
decisionAudit: {
|
|
@@ -3731,6 +3731,560 @@ function transitionActionProposalSupersession(row, replacement, command, now) {
|
|
|
3731
3731
|
}
|
|
3732
3732
|
__name(transitionActionProposalSupersession, "transitionActionProposalSupersession");
|
|
3733
3733
|
|
|
3734
|
+
// src/genui/builtins.ts
|
|
3735
|
+
var str = /* @__PURE__ */ __name((description, extra = {}) => ({
|
|
3736
|
+
type: "string",
|
|
3737
|
+
...description !== void 0 ? {
|
|
3738
|
+
description
|
|
3739
|
+
} : {},
|
|
3740
|
+
...extra
|
|
3741
|
+
}), "str");
|
|
3742
|
+
var obj = /* @__PURE__ */ __name((properties, required = []) => ({
|
|
3743
|
+
type: "object",
|
|
3744
|
+
properties,
|
|
3745
|
+
required,
|
|
3746
|
+
additionalProperties: false
|
|
3747
|
+
}), "obj");
|
|
3748
|
+
var arr = /* @__PURE__ */ __name((items, extra = {}) => ({
|
|
3749
|
+
type: "array",
|
|
3750
|
+
items,
|
|
3751
|
+
...extra
|
|
3752
|
+
}), "arr");
|
|
3753
|
+
var cell = {
|
|
3754
|
+
type: [
|
|
3755
|
+
"string",
|
|
3756
|
+
"number",
|
|
3757
|
+
"boolean",
|
|
3758
|
+
"null"
|
|
3759
|
+
]
|
|
3760
|
+
};
|
|
3761
|
+
var row = {
|
|
3762
|
+
type: "object",
|
|
3763
|
+
additionalProperties: cell
|
|
3764
|
+
};
|
|
3765
|
+
var s = /* @__PURE__ */ __name((value) => value === null || value === void 0 ? "" : String(value), "s");
|
|
3766
|
+
var heading = /* @__PURE__ */ __name((props) => props.title ? `*${s(props.title)}*
|
|
3767
|
+
` : "", "heading");
|
|
3768
|
+
function textTable(columns, rows, max = 15) {
|
|
3769
|
+
const shown = rows.slice(0, max);
|
|
3770
|
+
const widths = columns.map((column) => Math.min(28, Math.max(column.label.length, ...shown.map((r) => s(r[column.key]).length))));
|
|
3771
|
+
const format = /* @__PURE__ */ __name((values) => values.map((value, index) => value.slice(0, widths[index]).padEnd(widths[index] ?? 0)).join(" "), "format");
|
|
3772
|
+
const lines = [
|
|
3773
|
+
format(columns.map((column) => column.label)),
|
|
3774
|
+
widths.map((width) => "-".repeat(width)).join(" "),
|
|
3775
|
+
...shown.map((r) => format(columns.map((column) => s(r[column.key]))))
|
|
3776
|
+
];
|
|
3777
|
+
if (rows.length > max) lines.push(`\u2026 ${rows.length - max} more rows`);
|
|
3778
|
+
return `\`\`\`
|
|
3779
|
+
${lines.join("\n")}
|
|
3780
|
+
\`\`\``;
|
|
3781
|
+
}
|
|
3782
|
+
__name(textTable, "textTable");
|
|
3783
|
+
function lineDiff(before, after) {
|
|
3784
|
+
const a = before.split("\n");
|
|
3785
|
+
const b = after.split("\n");
|
|
3786
|
+
if (a.length * b.length > 25e4) {
|
|
3787
|
+
return [
|
|
3788
|
+
...a.map((text) => ({
|
|
3789
|
+
op: "del",
|
|
3790
|
+
text
|
|
3791
|
+
})),
|
|
3792
|
+
...b.map((text) => ({
|
|
3793
|
+
op: "add",
|
|
3794
|
+
text
|
|
3795
|
+
}))
|
|
3796
|
+
];
|
|
3797
|
+
}
|
|
3798
|
+
const dp = Array.from({
|
|
3799
|
+
length: a.length + 1
|
|
3800
|
+
}, () => new Array(b.length + 1).fill(0));
|
|
3801
|
+
const at = /* @__PURE__ */ __name((i2, j2) => dp[i2]?.[j2] ?? 0, "at");
|
|
3802
|
+
for (let i2 = a.length - 1; i2 >= 0; i2--) {
|
|
3803
|
+
for (let j2 = b.length - 1; j2 >= 0; j2--) {
|
|
3804
|
+
dp[i2][j2] = a[i2] === b[j2] ? at(i2 + 1, j2 + 1) + 1 : Math.max(at(i2 + 1, j2), at(i2, j2 + 1));
|
|
3805
|
+
}
|
|
3806
|
+
}
|
|
3807
|
+
const out = [];
|
|
3808
|
+
let i = 0;
|
|
3809
|
+
let j = 0;
|
|
3810
|
+
while (i < a.length && j < b.length) {
|
|
3811
|
+
if (a[i] === b[j]) {
|
|
3812
|
+
out.push({
|
|
3813
|
+
op: "same",
|
|
3814
|
+
text: a[i]
|
|
3815
|
+
});
|
|
3816
|
+
i++;
|
|
3817
|
+
j++;
|
|
3818
|
+
} else if (at(i + 1, j) >= at(i, j + 1)) {
|
|
3819
|
+
out.push({
|
|
3820
|
+
op: "del",
|
|
3821
|
+
text: a[i++]
|
|
3822
|
+
});
|
|
3823
|
+
} else {
|
|
3824
|
+
out.push({
|
|
3825
|
+
op: "add",
|
|
3826
|
+
text: b[j++]
|
|
3827
|
+
});
|
|
3828
|
+
}
|
|
3829
|
+
}
|
|
3830
|
+
while (i < a.length) out.push({
|
|
3831
|
+
op: "del",
|
|
3832
|
+
text: a[i++]
|
|
3833
|
+
});
|
|
3834
|
+
while (j < b.length) out.push({
|
|
3835
|
+
op: "add",
|
|
3836
|
+
text: b[j++]
|
|
3837
|
+
});
|
|
3838
|
+
return out;
|
|
3839
|
+
}
|
|
3840
|
+
__name(lineDiff, "lineDiff");
|
|
3841
|
+
function bar(value, max, width = 20) {
|
|
3842
|
+
const n = max > 0 ? Math.round(Math.abs(value) / max * width) : 0;
|
|
3843
|
+
return "\u2588".repeat(n) || "\u258F";
|
|
3844
|
+
}
|
|
3845
|
+
__name(bar, "bar");
|
|
3846
|
+
var DataTable = defineComponent({
|
|
3847
|
+
name: "DataTable",
|
|
3848
|
+
title: "Data table",
|
|
3849
|
+
description: "Tabular data (records with the same fields) as a sortable table. Prefer it over markdown tables for more than 3 rows.",
|
|
3850
|
+
props: obj({
|
|
3851
|
+
title: str("Short caption"),
|
|
3852
|
+
columns: arr(obj({
|
|
3853
|
+
key: str("Field name in each row"),
|
|
3854
|
+
label: str("Column header"),
|
|
3855
|
+
align: str(void 0, {
|
|
3856
|
+
enum: [
|
|
3857
|
+
"left",
|
|
3858
|
+
"right",
|
|
3859
|
+
"center"
|
|
3860
|
+
]
|
|
3861
|
+
}),
|
|
3862
|
+
format: str("How to format values", {
|
|
3863
|
+
enum: [
|
|
3864
|
+
"text",
|
|
3865
|
+
"number",
|
|
3866
|
+
"currency",
|
|
3867
|
+
"percent",
|
|
3868
|
+
"date",
|
|
3869
|
+
"link"
|
|
3870
|
+
]
|
|
3871
|
+
})
|
|
3872
|
+
}, [
|
|
3873
|
+
"key",
|
|
3874
|
+
"label"
|
|
3875
|
+
]), {
|
|
3876
|
+
minItems: 1,
|
|
3877
|
+
maxItems: 12
|
|
3878
|
+
}),
|
|
3879
|
+
rows: arr(row, {
|
|
3880
|
+
maxItems: 500
|
|
3881
|
+
})
|
|
3882
|
+
}, [
|
|
3883
|
+
"columns",
|
|
3884
|
+
"rows"
|
|
3885
|
+
]),
|
|
3886
|
+
fallbackText: /* @__PURE__ */ __name((props) => `${heading(props)}${textTable(props.columns ?? [], props.rows ?? [])}`, "fallbackText")
|
|
3887
|
+
});
|
|
3888
|
+
var Chart = defineComponent({
|
|
3889
|
+
name: "Chart",
|
|
3890
|
+
title: "Chart",
|
|
3891
|
+
description: "`bar` to compare categories, `line` for a trend over time. `data` is a list of points; `xKey` names the category/time field and each series names a numeric field.",
|
|
3892
|
+
props: obj({
|
|
3893
|
+
type: str("Chart type", {
|
|
3894
|
+
enum: [
|
|
3895
|
+
"bar",
|
|
3896
|
+
"line"
|
|
3897
|
+
]
|
|
3898
|
+
}),
|
|
3899
|
+
title: str(),
|
|
3900
|
+
xKey: str("Field of each point used for the x axis"),
|
|
3901
|
+
series: arr(obj({
|
|
3902
|
+
key: str("Numeric field"),
|
|
3903
|
+
label: str()
|
|
3904
|
+
}, [
|
|
3905
|
+
"key"
|
|
3906
|
+
]), {
|
|
3907
|
+
minItems: 1,
|
|
3908
|
+
maxItems: 6
|
|
3909
|
+
}),
|
|
3910
|
+
data: arr(row, {
|
|
3911
|
+
minItems: 1,
|
|
3912
|
+
maxItems: 200
|
|
3913
|
+
}),
|
|
3914
|
+
unit: str("Unit shown after values, e.g. `KB` or `%`")
|
|
3915
|
+
}, [
|
|
3916
|
+
"type",
|
|
3917
|
+
"xKey",
|
|
3918
|
+
"series",
|
|
3919
|
+
"data"
|
|
3920
|
+
]),
|
|
3921
|
+
fallbackText: /* @__PURE__ */ __name((props) => {
|
|
3922
|
+
const series = props.series ?? [];
|
|
3923
|
+
const data = props.data ?? [];
|
|
3924
|
+
const first = series[0]?.key ?? "";
|
|
3925
|
+
const max = Math.max(0, ...data.map((point) => Math.abs(Number(point[first]) || 0)));
|
|
3926
|
+
const unit = props.unit ? ` ${s(props.unit)}` : "";
|
|
3927
|
+
const lines = data.slice(0, 20).map((point) => `${s(point[props.xKey]).slice(0, 18).padEnd(18)} ${bar(Number(point[first]) || 0, max)} ${s(point[first])}${unit}`);
|
|
3928
|
+
return `${heading(props)}\`\`\`
|
|
3929
|
+
${lines.join("\n")}
|
|
3930
|
+
\`\`\``;
|
|
3931
|
+
}, "fallbackText")
|
|
3932
|
+
});
|
|
3933
|
+
var KpiCards = defineComponent({
|
|
3934
|
+
name: "KpiCards",
|
|
3935
|
+
title: "KPI cards",
|
|
3936
|
+
description: "A few key numbers (metrics, totals, counts) as cards.",
|
|
3937
|
+
props: obj({
|
|
3938
|
+
title: str(),
|
|
3939
|
+
items: arr(obj({
|
|
3940
|
+
label: str(),
|
|
3941
|
+
value: {
|
|
3942
|
+
type: [
|
|
3943
|
+
"string",
|
|
3944
|
+
"number"
|
|
3945
|
+
]
|
|
3946
|
+
},
|
|
3947
|
+
delta: str("Change, e.g. `+12%`"),
|
|
3948
|
+
trend: str(void 0, {
|
|
3949
|
+
enum: [
|
|
3950
|
+
"up",
|
|
3951
|
+
"down",
|
|
3952
|
+
"flat"
|
|
3953
|
+
]
|
|
3954
|
+
}),
|
|
3955
|
+
hint: str()
|
|
3956
|
+
}, [
|
|
3957
|
+
"label",
|
|
3958
|
+
"value"
|
|
3959
|
+
]), {
|
|
3960
|
+
minItems: 1,
|
|
3961
|
+
maxItems: 8
|
|
3962
|
+
})
|
|
3963
|
+
}, [
|
|
3964
|
+
"items"
|
|
3965
|
+
]),
|
|
3966
|
+
fallbackText: /* @__PURE__ */ __name((props) => `${heading(props)}${(props.items ?? []).map((item) => `\u2022 *${s(item.label)}:* ${s(item.value)}${item.delta ? ` (${s(item.delta)})` : ""}`).join("\n")}`, "fallbackText")
|
|
3967
|
+
});
|
|
3968
|
+
var SourceCards = defineComponent({
|
|
3969
|
+
name: "SourceCards",
|
|
3970
|
+
title: "Sources",
|
|
3971
|
+
description: "The documents, pages or links an answer is based on, as cards.",
|
|
3972
|
+
props: obj({
|
|
3973
|
+
title: str(),
|
|
3974
|
+
items: arr(obj({
|
|
3975
|
+
title: str(),
|
|
3976
|
+
url: str(),
|
|
3977
|
+
snippet: str(),
|
|
3978
|
+
source: str("e.g. Wiki, GitHub")
|
|
3979
|
+
}, [
|
|
3980
|
+
"title"
|
|
3981
|
+
]), {
|
|
3982
|
+
minItems: 1,
|
|
3983
|
+
maxItems: 12
|
|
3984
|
+
})
|
|
3985
|
+
}, [
|
|
3986
|
+
"items"
|
|
3987
|
+
]),
|
|
3988
|
+
fallbackText: /* @__PURE__ */ __name((props) => `${heading(props)}${(props.items ?? []).map((item) => `\u2022 ${item.url ? `<${s(item.url)}|${s(item.title)}>` : s(item.title)}${item.source ? ` \u2014 ${s(item.source)}` : ""}`).join("\n")}`, "fallbackText")
|
|
3989
|
+
});
|
|
3990
|
+
var Checklist = defineComponent({
|
|
3991
|
+
name: "Checklist",
|
|
3992
|
+
title: "Checklist",
|
|
3993
|
+
description: "Steps or a to-do list with done/not-done state.",
|
|
3994
|
+
props: obj({
|
|
3995
|
+
title: str(),
|
|
3996
|
+
items: arr(obj({
|
|
3997
|
+
label: str(),
|
|
3998
|
+
done: {
|
|
3999
|
+
type: "boolean"
|
|
4000
|
+
},
|
|
4001
|
+
note: str()
|
|
4002
|
+
}, [
|
|
4003
|
+
"label"
|
|
4004
|
+
]), {
|
|
4005
|
+
minItems: 1,
|
|
4006
|
+
maxItems: 50
|
|
4007
|
+
})
|
|
4008
|
+
}, [
|
|
4009
|
+
"items"
|
|
4010
|
+
]),
|
|
4011
|
+
fallbackText: /* @__PURE__ */ __name((props) => `${heading(props)}${(props.items ?? []).map((item) => `${item.done ? "\u2611" : "\u2610"} ${s(item.label)}${item.note ? ` \u2014 _${s(item.note)}_` : ""}`).join("\n")}`, "fallbackText")
|
|
4012
|
+
});
|
|
4013
|
+
var Timeline = defineComponent({
|
|
4014
|
+
name: "Timeline",
|
|
4015
|
+
title: "Timeline",
|
|
4016
|
+
description: "Events in chronological order (the history of a project, an incident, a deal).",
|
|
4017
|
+
props: obj({
|
|
4018
|
+
title: str(),
|
|
4019
|
+
events: arr(obj({
|
|
4020
|
+
date: str(),
|
|
4021
|
+
title: str(),
|
|
4022
|
+
description: str()
|
|
4023
|
+
}, [
|
|
4024
|
+
"title"
|
|
4025
|
+
]), {
|
|
4026
|
+
minItems: 1,
|
|
4027
|
+
maxItems: 50
|
|
4028
|
+
})
|
|
4029
|
+
}, [
|
|
4030
|
+
"events"
|
|
4031
|
+
]),
|
|
4032
|
+
fallbackText: /* @__PURE__ */ __name((props) => `${heading(props)}${(props.events ?? []).map((event) => `\u2022 ${event.date ? `*${s(event.date)}* ` : ""}${s(event.title)}${event.description ? ` \u2014 ${s(event.description)}` : ""}`).join("\n")}`, "fallbackText")
|
|
4033
|
+
});
|
|
4034
|
+
var CodeBlock = defineComponent({
|
|
4035
|
+
name: "CodeBlock",
|
|
4036
|
+
title: "Code",
|
|
4037
|
+
description: "A code snippet or file excerpt with syntax highlighting.",
|
|
4038
|
+
props: obj({
|
|
4039
|
+
title: str(),
|
|
4040
|
+
language: str(),
|
|
4041
|
+
code: str()
|
|
4042
|
+
}, [
|
|
4043
|
+
"code"
|
|
4044
|
+
]),
|
|
4045
|
+
fallbackText: /* @__PURE__ */ __name((props) => `${heading(props)}\`\`\`
|
|
4046
|
+
${s(props.code)}
|
|
4047
|
+
\`\`\``, "fallbackText")
|
|
4048
|
+
});
|
|
4049
|
+
var Diff = defineComponent({
|
|
4050
|
+
name: "Diff",
|
|
4051
|
+
title: "Diff",
|
|
4052
|
+
description: "A before/after change to a text or code file, as a line diff.",
|
|
4053
|
+
props: obj({
|
|
4054
|
+
title: str(),
|
|
4055
|
+
language: str(),
|
|
4056
|
+
before: str(),
|
|
4057
|
+
after: str()
|
|
4058
|
+
}, [
|
|
4059
|
+
"before",
|
|
4060
|
+
"after"
|
|
4061
|
+
]),
|
|
4062
|
+
fallbackText: /* @__PURE__ */ __name((props) => `${heading(props)}\`\`\`
|
|
4063
|
+
${lineDiff(s(props.before), s(props.after)).map((line) => `${line.op === "add" ? "+" : line.op === "del" ? "-" : " "} ${line.text}`).join("\n")}
|
|
4064
|
+
\`\`\``, "fallbackText")
|
|
4065
|
+
});
|
|
4066
|
+
var Callout = defineComponent({
|
|
4067
|
+
name: "Callout",
|
|
4068
|
+
title: "Callout",
|
|
4069
|
+
description: "A short note, warning or success message, emphasized.",
|
|
4070
|
+
props: obj({
|
|
4071
|
+
tone: str(void 0, {
|
|
4072
|
+
enum: [
|
|
4073
|
+
"info",
|
|
4074
|
+
"success",
|
|
4075
|
+
"warning",
|
|
4076
|
+
"danger"
|
|
4077
|
+
]
|
|
4078
|
+
}),
|
|
4079
|
+
title: str(),
|
|
4080
|
+
text: str()
|
|
4081
|
+
}, [
|
|
4082
|
+
"text"
|
|
4083
|
+
]),
|
|
4084
|
+
fallbackText: /* @__PURE__ */ __name((props) => `${props.tone === "warning" || props.tone === "danger" ? ":warning: " : ":information_source: "}${heading(props)}${s(props.text)}`, "fallbackText")
|
|
4085
|
+
});
|
|
4086
|
+
var Stack = defineComponent({
|
|
4087
|
+
name: "Stack",
|
|
4088
|
+
title: "Stack",
|
|
4089
|
+
description: "Lays its children out vertically (or horizontally with direction=row).",
|
|
4090
|
+
props: obj({
|
|
4091
|
+
direction: str(void 0, {
|
|
4092
|
+
enum: [
|
|
4093
|
+
"column",
|
|
4094
|
+
"row"
|
|
4095
|
+
]
|
|
4096
|
+
}),
|
|
4097
|
+
gap: {
|
|
4098
|
+
type: "number"
|
|
4099
|
+
}
|
|
4100
|
+
}),
|
|
4101
|
+
children: true,
|
|
4102
|
+
fallbackText: /* @__PURE__ */ __name(() => "", "fallbackText")
|
|
4103
|
+
});
|
|
4104
|
+
var Card = defineComponent({
|
|
4105
|
+
name: "Card",
|
|
4106
|
+
title: "Card",
|
|
4107
|
+
description: "A box with an optional title around its children.",
|
|
4108
|
+
props: obj({
|
|
4109
|
+
title: str(),
|
|
4110
|
+
subtitle: str()
|
|
4111
|
+
}),
|
|
4112
|
+
children: true,
|
|
4113
|
+
fallbackText: /* @__PURE__ */ __name((props) => props.title ? `*${s(props.title)}*${props.subtitle ? ` \u2014 ${s(props.subtitle)}` : ""}` : "", "fallbackText")
|
|
4114
|
+
});
|
|
4115
|
+
var Heading = defineComponent({
|
|
4116
|
+
name: "Heading",
|
|
4117
|
+
title: "Heading",
|
|
4118
|
+
description: "A heading.",
|
|
4119
|
+
props: obj({
|
|
4120
|
+
text: str()
|
|
4121
|
+
}, [
|
|
4122
|
+
"text"
|
|
4123
|
+
]),
|
|
4124
|
+
fallbackText: /* @__PURE__ */ __name((props) => `*${s(props.text)}*`, "fallbackText")
|
|
4125
|
+
});
|
|
4126
|
+
var Text = defineComponent({
|
|
4127
|
+
name: "Text",
|
|
4128
|
+
title: "Text",
|
|
4129
|
+
description: "A paragraph of plain text (no markdown).",
|
|
4130
|
+
props: obj({
|
|
4131
|
+
text: str(),
|
|
4132
|
+
muted: {
|
|
4133
|
+
type: "boolean"
|
|
4134
|
+
}
|
|
4135
|
+
}, [
|
|
4136
|
+
"text"
|
|
4137
|
+
]),
|
|
4138
|
+
fallbackText: /* @__PURE__ */ __name((props) => s(props.text), "fallbackText")
|
|
4139
|
+
});
|
|
4140
|
+
var Badge = defineComponent({
|
|
4141
|
+
name: "Badge",
|
|
4142
|
+
title: "Badge",
|
|
4143
|
+
description: "A small label.",
|
|
4144
|
+
props: obj({
|
|
4145
|
+
text: str(),
|
|
4146
|
+
tone: str(void 0, {
|
|
4147
|
+
enum: [
|
|
4148
|
+
"neutral",
|
|
4149
|
+
"brand",
|
|
4150
|
+
"success",
|
|
4151
|
+
"warning",
|
|
4152
|
+
"danger"
|
|
4153
|
+
]
|
|
4154
|
+
})
|
|
4155
|
+
}, [
|
|
4156
|
+
"text"
|
|
4157
|
+
]),
|
|
4158
|
+
fallbackText: /* @__PURE__ */ __name((props) => `[${s(props.text)}]`, "fallbackText")
|
|
4159
|
+
});
|
|
4160
|
+
var Link = defineComponent({
|
|
4161
|
+
name: "Link",
|
|
4162
|
+
title: "Link",
|
|
4163
|
+
description: "A link to an http(s) URL.",
|
|
4164
|
+
props: obj({
|
|
4165
|
+
text: str(),
|
|
4166
|
+
url: str(void 0, {
|
|
4167
|
+
pattern: "^https?://"
|
|
4168
|
+
})
|
|
4169
|
+
}, [
|
|
4170
|
+
"text",
|
|
4171
|
+
"url"
|
|
4172
|
+
]),
|
|
4173
|
+
fallbackText: /* @__PURE__ */ __name((props) => `<${s(props.url)}|${s(props.text || props.url)}>`, "fallbackText")
|
|
4174
|
+
});
|
|
4175
|
+
var Image = defineComponent({
|
|
4176
|
+
name: "Image",
|
|
4177
|
+
title: "Image",
|
|
4178
|
+
description: "An image from an https URL.",
|
|
4179
|
+
props: obj({
|
|
4180
|
+
url: str(void 0, {
|
|
4181
|
+
pattern: "^https://"
|
|
4182
|
+
}),
|
|
4183
|
+
alt: str()
|
|
4184
|
+
}, [
|
|
4185
|
+
"url"
|
|
4186
|
+
]),
|
|
4187
|
+
fallbackText: /* @__PURE__ */ __name((props) => s(props.url), "fallbackText")
|
|
4188
|
+
});
|
|
4189
|
+
|
|
4190
|
+
// src/genui/registry.ts
|
|
4191
|
+
function snapshotComponentPresentation(value) {
|
|
4192
|
+
const seen = /* @__PURE__ */ new Set();
|
|
4193
|
+
const check2 = /* @__PURE__ */ __name((entry) => {
|
|
4194
|
+
if (entry === null || typeof entry === "string" || typeof entry === "boolean") return;
|
|
4195
|
+
if (typeof entry === "number" && Number.isFinite(entry)) return;
|
|
4196
|
+
if (typeof entry !== "object" || entry === null) throw new TypeError("genui: presentation must contain only JSON values");
|
|
4197
|
+
if (seen.has(entry)) throw new TypeError("genui: presentation must contain acyclic JSON values");
|
|
4198
|
+
if (!Array.isArray(entry) && Object.getPrototypeOf(entry) !== Object.prototype && Object.getPrototypeOf(entry) !== null) throw new TypeError("genui: presentation must contain plain JSON objects");
|
|
4199
|
+
seen.add(entry);
|
|
4200
|
+
for (const item of Object.values(entry)) check2(item);
|
|
4201
|
+
seen.delete(entry);
|
|
4202
|
+
}, "check");
|
|
4203
|
+
check2(value);
|
|
4204
|
+
return JSON.parse(JSON.stringify(value));
|
|
4205
|
+
}
|
|
4206
|
+
__name(snapshotComponentPresentation, "snapshotComponentPresentation");
|
|
4207
|
+
function createComponent(definition, options = {}) {
|
|
4208
|
+
defineComponent(definition);
|
|
4209
|
+
const catalog = defineCatalog([
|
|
4210
|
+
definition
|
|
4211
|
+
], options);
|
|
4212
|
+
const factory = /* @__PURE__ */ __name(async (props) => {
|
|
4213
|
+
const result2 = await validateProps(definition.props, props, catalog.validator);
|
|
4214
|
+
if (!result2.ok) throw new Error(`genui: invalid ${definition.name} props: ${formatIssues(result2.issues)}`);
|
|
4215
|
+
const normalized = snapshotComponentPresentation(result2.value);
|
|
4216
|
+
if (typeof normalized !== "object" || normalized === null || Array.isArray(normalized)) throw new TypeError("genui: component props must be a JSON object");
|
|
4217
|
+
const portable = await catalog.validate(definition.name, normalized);
|
|
4218
|
+
if (!portable.ok || canonicalJson(snapshotComponentPresentation(portable.value)) !== canonicalJson(normalized)) {
|
|
4219
|
+
throw new Error(`genui: ${definition.name} requires outputProps accepting stable normalized JSON props`);
|
|
4220
|
+
}
|
|
4221
|
+
return {
|
|
4222
|
+
component: definition.name,
|
|
4223
|
+
props: normalized,
|
|
4224
|
+
version: definition.version ?? 1,
|
|
4225
|
+
fallbackText: componentToText(catalog, definition.name, normalized)
|
|
4226
|
+
};
|
|
4227
|
+
}, "factory");
|
|
4228
|
+
return Object.assign(factory, {
|
|
4229
|
+
definition
|
|
4230
|
+
});
|
|
4231
|
+
}
|
|
4232
|
+
__name(createComponent, "createComponent");
|
|
4233
|
+
var table = createComponent(DataTable);
|
|
4234
|
+
var chart = createComponent(Chart);
|
|
4235
|
+
function validatePresentationBatch(presentations) {
|
|
4236
|
+
const batch = Array.isArray(presentations) ? presentations : [
|
|
4237
|
+
presentations
|
|
4238
|
+
];
|
|
4239
|
+
return batch.map((item) => {
|
|
4240
|
+
const presentation = snapshotComponentPresentation(item);
|
|
4241
|
+
if (typeof presentation !== "object" || presentation === null || typeof presentation.component !== "string" || !/^[A-Za-z][A-Za-z0-9]{0,63}$/.test(presentation.component) || !Number.isSafeInteger(presentation.version) || presentation.version <= 0 || typeof presentation.fallbackText !== "string" || typeof presentation.props !== "object" || presentation.props === null || Array.isArray(presentation.props)) {
|
|
4242
|
+
throw new TypeError("genui: invalid component presentation");
|
|
4243
|
+
}
|
|
4244
|
+
return presentation;
|
|
4245
|
+
});
|
|
4246
|
+
}
|
|
4247
|
+
__name(validatePresentationBatch, "validatePresentationBatch");
|
|
4248
|
+
function canonicalJson(value) {
|
|
4249
|
+
if (Array.isArray(value)) return `[${value.map(canonicalJson).join(",")}]`;
|
|
4250
|
+
if (typeof value === "object" && value !== null) {
|
|
4251
|
+
const record2 = value;
|
|
4252
|
+
return `{${Object.keys(record2).sort().map((key) => `${JSON.stringify(key)}:${canonicalJson(record2[key])}`).join(",")}}`;
|
|
4253
|
+
}
|
|
4254
|
+
return JSON.stringify(value);
|
|
4255
|
+
}
|
|
4256
|
+
__name(canonicalJson, "canonicalJson");
|
|
4257
|
+
|
|
4258
|
+
// src/tool-presentations.ts
|
|
4259
|
+
async function emitToolPresentations(handler, output, ctx, toolName) {
|
|
4260
|
+
if (handler.present === void 0) return;
|
|
4261
|
+
try {
|
|
4262
|
+
const result2 = await handler.present(output, ctx);
|
|
4263
|
+
if (result2 === void 0) return;
|
|
4264
|
+
const batch = validatePresentationBatch(result2);
|
|
4265
|
+
for (const presentation of batch) {
|
|
4266
|
+
await ctx.emitUi(presentation.component, presentation.props, {
|
|
4267
|
+
version: presentation.version,
|
|
4268
|
+
fallbackText: presentation.fallbackText
|
|
4269
|
+
});
|
|
4270
|
+
}
|
|
4271
|
+
} catch (error) {
|
|
4272
|
+
if (ctx.onPresentationError !== void 0) {
|
|
4273
|
+
try {
|
|
4274
|
+
await ctx.onPresentationError(error, {
|
|
4275
|
+
toolName
|
|
4276
|
+
});
|
|
4277
|
+
return;
|
|
4278
|
+
} catch (reportError) {
|
|
4279
|
+
console.warn(`Tool "${toolName}" presentation error reporter failed`, reportError);
|
|
4280
|
+
}
|
|
4281
|
+
} else {
|
|
4282
|
+
console.warn(`Tool "${toolName}" presentation failed after successful execution`, error);
|
|
4283
|
+
}
|
|
4284
|
+
}
|
|
4285
|
+
}
|
|
4286
|
+
__name(emitToolPresentations, "emitToolPresentations");
|
|
4287
|
+
|
|
3734
4288
|
// src/tool-registry.ts
|
|
3735
4289
|
var ToolForbiddenError = class extends Error {
|
|
3736
4290
|
static {
|
|
@@ -3813,6 +4367,15 @@ var ToolRegistry = class {
|
|
|
3813
4367
|
handler
|
|
3814
4368
|
});
|
|
3815
4369
|
}
|
|
4370
|
+
/** Whether a successful preflight shortcut has UI to journal. */
|
|
4371
|
+
hasPresentation(name) {
|
|
4372
|
+
return typeof this.entries.get(name)?.handler.present === "function";
|
|
4373
|
+
}
|
|
4374
|
+
/** Present an already authorized successful domain result without executing its action again. */
|
|
4375
|
+
async presentOutput(name, output, ctx) {
|
|
4376
|
+
const entry = this.entries.get(name);
|
|
4377
|
+
if (entry !== void 0) await emitToolPresentations(entry.handler, output, ctx, name);
|
|
4378
|
+
}
|
|
3816
4379
|
has(name) {
|
|
3817
4380
|
return this.entries.has(name);
|
|
3818
4381
|
}
|
|
@@ -3898,8 +4461,9 @@ var ToolRegistry = class {
|
|
|
3898
4461
|
}) : void 0;
|
|
3899
4462
|
if (trusted) assertTrustedInput(name, hookInput, executionInput);
|
|
3900
4463
|
if (result2?.status === "denied") throw new ToolPreflightDeniedError(name, result2.reason);
|
|
3901
|
-
|
|
3902
|
-
|
|
4464
|
+
const output = result2?.status === "completed" ? result2.output : await entry.handler.execute(executionInput, withEmit);
|
|
4465
|
+
await emitToolPresentations(entry.handler, output, withEmit, name);
|
|
4466
|
+
return output;
|
|
3903
4467
|
}
|
|
3904
4468
|
/** Authorize and validate without executing. The caller journals this result before approval. */
|
|
3905
4469
|
async prepare(name, input, ctx, policy, options = {}) {
|
|
@@ -3965,6 +4529,7 @@ var DefaultRolesPolicy = class {
|
|
|
3965
4529
|
this.emptyRoles = options.emptyRoles ?? "allow";
|
|
3966
4530
|
}
|
|
3967
4531
|
can(actor, tool) {
|
|
4532
|
+
if (tool.ability !== void 0 && tool.roles === void 0) return false;
|
|
3968
4533
|
const allowed = tool.roles ?? this.defaultRoles;
|
|
3969
4534
|
if (allowed.length === 0) return this.emptyRoles === "allow";
|
|
3970
4535
|
return (actor.roles ?? []).some((role) => allowed.includes(role));
|
|
@@ -4114,7 +4679,8 @@ var AGENT_SPAN_EVENTS = [
|
|
|
4114
4679
|
"llm.turn",
|
|
4115
4680
|
"tool.execution",
|
|
4116
4681
|
"retrieval",
|
|
4117
|
-
"follow-ups"
|
|
4682
|
+
"follow-ups",
|
|
4683
|
+
"structured-output"
|
|
4118
4684
|
];
|
|
4119
4685
|
var AGENT_DIAGNOSTIC_EVENTS = [
|
|
4120
4686
|
"run.started",
|
|
@@ -4152,8 +4718,19 @@ function createNegotiatedUiCollector(toolCallId, scope, resolveCatalog, write) {
|
|
|
4152
4718
|
}, "restart"),
|
|
4153
4719
|
emit: /* @__PURE__ */ __name(async (component, props, options = {}) => {
|
|
4154
4720
|
if (!resolveCatalog) {
|
|
4155
|
-
|
|
4156
|
-
return collector.emit(component, props, options);
|
|
4721
|
+
const declared = scope.uiCapabilities === void 0 || scope.uiCapabilities.components.some((entry) => entry.name === component && entry.version === (options.version ?? 1));
|
|
4722
|
+
if (declared) return collector.emit(component, props, options);
|
|
4723
|
+
const id2 = options.id ?? `${toolCallId}:ui:${next++}`;
|
|
4724
|
+
if (options.fallbackText !== void 0 && options.fallbackText.length > 0) {
|
|
4725
|
+
texts.set(id2, options.fallbackText);
|
|
4726
|
+
await write?.({
|
|
4727
|
+
kind: "text",
|
|
4728
|
+
text: options.fallbackText
|
|
4729
|
+
});
|
|
4730
|
+
}
|
|
4731
|
+
return {
|
|
4732
|
+
id: id2
|
|
4733
|
+
};
|
|
4157
4734
|
}
|
|
4158
4735
|
const capturedProps = snapshotActionProposal(props);
|
|
4159
4736
|
const capturedOptions = {
|
|
@@ -5240,6 +5817,10 @@ async function claimToolCall(turn, call) {
|
|
|
5240
5817
|
...spec?.terminal === true ? {
|
|
5241
5818
|
terminal: true
|
|
5242
5819
|
} : {},
|
|
5820
|
+
// Journal this extra checkpoint's opt-in; historical claims without it keep their sequence.
|
|
5821
|
+
...preflight?.status === "completed" && deps.registry.hasPresentation(call.name) ? {
|
|
5822
|
+
presentCompletedPreflight: true
|
|
5823
|
+
} : {},
|
|
5243
5824
|
...approval !== void 0 ? {
|
|
5244
5825
|
approval
|
|
5245
5826
|
} : {},
|
|
@@ -5270,6 +5851,9 @@ async function claimToolCall(turn, call) {
|
|
|
5270
5851
|
...persisted?.terminal === true ? {
|
|
5271
5852
|
terminal: true
|
|
5272
5853
|
} : {},
|
|
5854
|
+
...persisted?.presentCompletedPreflight === true ? {
|
|
5855
|
+
presentCompletedPreflight: true
|
|
5856
|
+
} : {},
|
|
5273
5857
|
...toolType === "action" && persisted?.approval !== void 0 ? {
|
|
5274
5858
|
approval: persisted.approval
|
|
5275
5859
|
} : {},
|
|
@@ -5796,6 +6380,19 @@ async function runClaimedToolCall(turn, claimed) {
|
|
|
5796
6380
|
}
|
|
5797
6381
|
if (claimed.preflight !== void 0 && claimed.preflight.status !== "ready") {
|
|
5798
6382
|
const result2 = claimed.preflight;
|
|
6383
|
+
if (result2.status === "completed" && claimed.presentCompletedPreflight === true) {
|
|
6384
|
+
const raw = await hooks.step(`present:${call.id}`, async () => {
|
|
6385
|
+
const ui = createNegotiatedUiCollector(call.id, ctx, deps.resolveUiCatalog, (event) => turn.writer.write(encodeStreamEvent(event)));
|
|
6386
|
+
await deps.registry.presentOutput(call.name, result2.output, {
|
|
6387
|
+
...toolCallContext(ctx, call.id),
|
|
6388
|
+
emitUi: ui.emit
|
|
6389
|
+
});
|
|
6390
|
+
return wrapToolStepOutput(result2.output, ui.components(), ui.text());
|
|
6391
|
+
});
|
|
6392
|
+
const presented = unwrapToolStepOutput(raw);
|
|
6393
|
+
if (presented.ui.length > 0) turn.toolUi.set(call.id, presented.ui);
|
|
6394
|
+
if (presented.text) turn.toolText.set(call.id, presented.text);
|
|
6395
|
+
}
|
|
5799
6396
|
if (result2.status === "completed" && claimed.terminal === true) turn.halt.terminal = true;
|
|
5800
6397
|
const outcome = result2.status === "completed" ? {
|
|
5801
6398
|
status: "executed",
|
|
@@ -6687,14 +7284,14 @@ var InMemoryActionProposalStore = class {
|
|
|
6687
7284
|
}
|
|
6688
7285
|
async createActionProposal(input) {
|
|
6689
7286
|
validateActionProposalCreation(input);
|
|
6690
|
-
const
|
|
6691
|
-
if (
|
|
6692
|
-
if (!actionProposalScopeMatches(
|
|
7287
|
+
const row2 = this.rows.get(input.id);
|
|
7288
|
+
if (row2) {
|
|
7289
|
+
if (!actionProposalScopeMatches(row2, input)) return {
|
|
6693
7290
|
status: "conflict"
|
|
6694
7291
|
};
|
|
6695
7292
|
return {
|
|
6696
|
-
status: actionProposalCreationMatches(
|
|
6697
|
-
proposal: snapshotActionProposal(
|
|
7293
|
+
status: actionProposalCreationMatches(row2, input) ? "unchanged" : "conflict",
|
|
7294
|
+
proposal: snapshotActionProposal(row2)
|
|
6698
7295
|
};
|
|
6699
7296
|
}
|
|
6700
7297
|
const proposal = initialActionProposal(input, this.clock());
|
|
@@ -6705,42 +7302,42 @@ var InMemoryActionProposalStore = class {
|
|
|
6705
7302
|
};
|
|
6706
7303
|
}
|
|
6707
7304
|
async getActionProposal(scope, id) {
|
|
6708
|
-
const
|
|
6709
|
-
return
|
|
7305
|
+
const row2 = this.rows.get(id);
|
|
7306
|
+
return row2 && actionProposalScopeMatches(row2, scope) ? snapshotActionProposal(row2) : null;
|
|
6710
7307
|
}
|
|
6711
7308
|
async listActionProposals(scope, query = {}) {
|
|
6712
7309
|
const limit = validateActionProposalListQuery(query);
|
|
6713
7310
|
return [
|
|
6714
7311
|
...this.rows.values()
|
|
6715
|
-
].filter((
|
|
7312
|
+
].filter((row2) => actionProposalScopeMatches(row2, scope) && (query.decision === void 0 || row2.decision === query.decision) && (query.after === void 0 || row2.createdAt > query.after.createdAt || row2.createdAt === query.after.createdAt && row2.id > query.after.id)).sort((a, b) => a.createdAt - b.createdAt || (a.id < b.id ? -1 : a.id > b.id ? 1 : 0)).slice(0, limit).map(snapshotActionProposal);
|
|
6716
7313
|
}
|
|
6717
7314
|
mutate(scope, id, transition) {
|
|
6718
|
-
const
|
|
6719
|
-
if (!
|
|
7315
|
+
const row2 = this.rows.get(id);
|
|
7316
|
+
if (!row2 || !actionProposalScopeMatches(row2, scope)) return {
|
|
6720
7317
|
status: "not_found"
|
|
6721
7318
|
};
|
|
6722
|
-
const result2 = transition(
|
|
7319
|
+
const result2 = transition(row2, this.clock());
|
|
6723
7320
|
if (result2.proposal) this.rows.set(id, snapshotActionProposal(result2.proposal));
|
|
6724
7321
|
return result2;
|
|
6725
7322
|
}
|
|
6726
7323
|
async decideActionProposal(scope, id, command) {
|
|
6727
|
-
return this.mutate(scope, id, (
|
|
7324
|
+
return this.mutate(scope, id, (row2, now) => transitionActionProposalDecision(row2, command, now));
|
|
6728
7325
|
}
|
|
6729
7326
|
async claimActionProposal(scope, id, command) {
|
|
6730
|
-
return this.mutate(scope, id, (
|
|
7327
|
+
return this.mutate(scope, id, (row2, now) => transitionActionProposalClaim(row2, command, now, randomUUID()));
|
|
6731
7328
|
}
|
|
6732
7329
|
async extendActionProposalLease(scope, id, command) {
|
|
6733
|
-
return this.mutate(scope, id, (
|
|
7330
|
+
return this.mutate(scope, id, (row2, now) => transitionActionProposalLease(row2, command, now));
|
|
6734
7331
|
}
|
|
6735
7332
|
async settleActionProposal(scope, id, command) {
|
|
6736
|
-
return this.mutate(scope, id, (
|
|
7333
|
+
return this.mutate(scope, id, (row2, now) => transitionActionProposalSettlement(row2, command, now));
|
|
6737
7334
|
}
|
|
6738
7335
|
async claimNextActionProposal(command) {
|
|
6739
7336
|
const now = this.clock();
|
|
6740
7337
|
validateActionProposalWorkerClaim(command, now);
|
|
6741
7338
|
const candidates = [
|
|
6742
7339
|
...this.rows.values()
|
|
6743
|
-
].filter((
|
|
7340
|
+
].filter((row2) => row2.decision === "approved" && (row2.execution?.status === "queued" || row2.execution?.status === "executing" && row2.execution.lease !== null && now >= row2.execution.lease.expiresAt)).sort((a, b) => a.createdAt - b.createdAt || (a.id < b.id ? -1 : a.id > b.id ? 1 : 0)).slice(0, 32);
|
|
6744
7341
|
for (const candidate of candidates) {
|
|
6745
7342
|
const claimed = await this.claimActionProposal(candidate, candidate.id, command);
|
|
6746
7343
|
if (claimed.status === "applied" && claimed.proposal) return claimed.proposal;
|
|
@@ -6752,7 +7349,7 @@ var InMemoryActionProposalStore = class {
|
|
|
6752
7349
|
validateActionProposalExpiryBatch(command, now);
|
|
6753
7350
|
const candidates = [
|
|
6754
7351
|
...this.rows.values()
|
|
6755
|
-
].filter((
|
|
7352
|
+
].filter((row2) => row2.decision === "pending" && row2.expiresAt !== null && now >= row2.expiresAt).sort((a, b) => a.createdAt - b.createdAt || (a.id < b.id ? -1 : a.id > b.id ? 1 : 0)).slice(0, command.limit);
|
|
6756
7353
|
let expired = 0;
|
|
6757
7354
|
for (const candidate of candidates) {
|
|
6758
7355
|
const result2 = await this.decideActionProposal(candidate, candidate.id, {
|
|
@@ -6769,11 +7366,11 @@ var InMemoryActionProposalStore = class {
|
|
|
6769
7366
|
validateActionProposalWorkerClaim(command, now);
|
|
6770
7367
|
const candidates = [
|
|
6771
7368
|
...this.rows.values()
|
|
6772
|
-
].filter((
|
|
7369
|
+
].filter((row2) => row2.outcomeDelivery?.status === "pending" && (!row2.outcomeDelivery.lease || now >= row2.outcomeDelivery.lease.expiresAt)).sort((a, b) => a.createdAt - b.createdAt || (a.id < b.id ? -1 : a.id > b.id ? 1 : 0)).slice(0, 32);
|
|
6773
7370
|
for (const candidate of candidates) {
|
|
6774
|
-
const
|
|
6775
|
-
if (!
|
|
6776
|
-
const next = claimActionProposalOutcome(
|
|
7371
|
+
const row2 = this.rows.get(candidate.id);
|
|
7372
|
+
if (!row2) continue;
|
|
7373
|
+
const next = claimActionProposalOutcome(row2, command, this.clock(), randomUUID());
|
|
6777
7374
|
if (!next?.outcome || !next.outcomeDelivery?.lease) continue;
|
|
6778
7375
|
this.rows.set(next.id, next);
|
|
6779
7376
|
return {
|
|
@@ -6793,9 +7390,9 @@ var InMemoryActionProposalStore = class {
|
|
|
6793
7390
|
if (existing) return this.createActionProposal(input);
|
|
6794
7391
|
const proposal = initialActionProposal(input, this.clock());
|
|
6795
7392
|
const replacements = [];
|
|
6796
|
-
if (input.replacementKey) for (const
|
|
6797
|
-
if (
|
|
6798
|
-
const result2 = transitionActionProposalSupersession(
|
|
7393
|
+
if (input.replacementKey) for (const row2 of this.rows.values()) {
|
|
7394
|
+
if (row2.decision !== "pending" || !actionProposalScopeMatches(row2, input) || row2.toolName !== input.toolName || row2.replacementKey !== input.replacementKey) continue;
|
|
7395
|
+
const result2 = transitionActionProposalSupersession(row2, proposal, {
|
|
6799
7396
|
replacementProposalId: proposal.id,
|
|
6800
7397
|
actorRef: input.actorRef,
|
|
6801
7398
|
via: "supersession"
|
|
@@ -6803,7 +7400,7 @@ var InMemoryActionProposalStore = class {
|
|
|
6803
7400
|
if (result2.proposal) replacements.push(result2.proposal);
|
|
6804
7401
|
}
|
|
6805
7402
|
this.rows.set(proposal.id, proposal);
|
|
6806
|
-
for (const
|
|
7403
|
+
for (const row2 of replacements) this.rows.set(row2.id, row2);
|
|
6807
7404
|
return {
|
|
6808
7405
|
status: "created",
|
|
6809
7406
|
proposal: snapshotActionProposal(proposal)
|
|
@@ -6814,7 +7411,7 @@ var InMemoryActionProposalStore = class {
|
|
|
6814
7411
|
if (!replacement || !actionProposalScopeMatches(replacement, scope)) return {
|
|
6815
7412
|
status: "not_found"
|
|
6816
7413
|
};
|
|
6817
|
-
return this.mutate(scope, id, (
|
|
7414
|
+
return this.mutate(scope, id, (row2, now) => transitionActionProposalSupersession(row2, replacement, command, now));
|
|
6818
7415
|
}
|
|
6819
7416
|
};
|
|
6820
7417
|
|
|
@@ -6839,7 +7436,7 @@ var InMemoryAgentStore = class extends InMemoryActionProposalStore {
|
|
|
6839
7436
|
throw new Error(`thread ${id} already exists`);
|
|
6840
7437
|
}
|
|
6841
7438
|
const ts = this.now();
|
|
6842
|
-
const
|
|
7439
|
+
const row2 = {
|
|
6843
7440
|
id,
|
|
6844
7441
|
actorRef: input.actor.id,
|
|
6845
7442
|
tenantRef: input.actor.tenantRef ?? null,
|
|
@@ -6852,20 +7449,20 @@ var InMemoryAgentStore = class extends InMemoryActionProposalStore {
|
|
|
6852
7449
|
persona: input.persona
|
|
6853
7450
|
} : {}
|
|
6854
7451
|
};
|
|
6855
|
-
this.threads.set(id,
|
|
6856
|
-
return this.toSummary(
|
|
7452
|
+
this.threads.set(id, row2);
|
|
7453
|
+
return this.toSummary(row2);
|
|
6857
7454
|
}
|
|
6858
7455
|
async getThread(threadId) {
|
|
6859
|
-
const
|
|
6860
|
-
if (
|
|
7456
|
+
const row2 = this.threads.get(threadId);
|
|
7457
|
+
if (row2 === void 0) {
|
|
6861
7458
|
return null;
|
|
6862
7459
|
}
|
|
6863
7460
|
return {
|
|
6864
|
-
...this.toSummary(
|
|
6865
|
-
messages:
|
|
7461
|
+
...this.toSummary(row2),
|
|
7462
|
+
messages: row2.messages.map((message) => this.withApprovals(message)),
|
|
6866
7463
|
// The run streaming right now — the one field the read-model reports it under.
|
|
6867
|
-
...
|
|
6868
|
-
activeRunId:
|
|
7464
|
+
...row2.activeStreamId !== void 0 ? {
|
|
7465
|
+
activeRunId: row2.activeStreamId
|
|
6869
7466
|
} : {}
|
|
6870
7467
|
};
|
|
6871
7468
|
}
|
|
@@ -6931,7 +7528,7 @@ var InMemoryAgentStore = class extends InMemoryActionProposalStore {
|
|
|
6931
7528
|
async listThreads(actorRef, limit = 50) {
|
|
6932
7529
|
return [
|
|
6933
7530
|
...this.threads.values()
|
|
6934
|
-
].filter((
|
|
7531
|
+
].filter((row2) => row2.actorRef === actorRef && !row2.transient).sort((a, b) => b.updatedAt.localeCompare(a.updatedAt)).slice(0, limit).map((row2) => this.toSummary(row2));
|
|
6935
7532
|
}
|
|
6936
7533
|
async softDeleteThread(threadId) {
|
|
6937
7534
|
this.threads.delete(threadId);
|
|
@@ -6947,7 +7544,7 @@ var InMemoryAgentStore = class extends InMemoryActionProposalStore {
|
|
|
6947
7544
|
];
|
|
6948
7545
|
const id = crypto.randomUUID();
|
|
6949
7546
|
const ts = this.now();
|
|
6950
|
-
const
|
|
7547
|
+
const row2 = {
|
|
6951
7548
|
id,
|
|
6952
7549
|
actorRef: source.actorRef,
|
|
6953
7550
|
tenantRef: source.tenantRef,
|
|
@@ -6969,8 +7566,8 @@ var InMemoryAgentStore = class extends InMemoryActionProposalStore {
|
|
|
6969
7566
|
persona: source.persona
|
|
6970
7567
|
} : {}
|
|
6971
7568
|
};
|
|
6972
|
-
this.threads.set(id,
|
|
6973
|
-
return this.toSummary(
|
|
7569
|
+
this.threads.set(id, row2);
|
|
7570
|
+
return this.toSummary(row2);
|
|
6974
7571
|
}
|
|
6975
7572
|
async ownerOfThread(threadId) {
|
|
6976
7573
|
return this.threads.get(threadId)?.actorRef ?? null;
|
|
@@ -6990,38 +7587,38 @@ var InMemoryAgentStore = class extends InMemoryActionProposalStore {
|
|
|
6990
7587
|
return call.runId ?? this.threads.get(call.threadId)?.activeStreamId ?? null;
|
|
6991
7588
|
}
|
|
6992
7589
|
async ownerOfActiveStream(runId) {
|
|
6993
|
-
for (const
|
|
6994
|
-
if (
|
|
6995
|
-
return
|
|
7590
|
+
for (const row2 of this.threads.values()) {
|
|
7591
|
+
if (row2.activeStreamId === runId) {
|
|
7592
|
+
return row2.actorRef;
|
|
6996
7593
|
}
|
|
6997
7594
|
}
|
|
6998
7595
|
return null;
|
|
6999
7596
|
}
|
|
7000
7597
|
async setTitle(threadId, title) {
|
|
7001
|
-
const
|
|
7002
|
-
if (
|
|
7003
|
-
|
|
7004
|
-
|
|
7598
|
+
const row2 = this.threads.get(threadId);
|
|
7599
|
+
if (row2 !== void 0) {
|
|
7600
|
+
row2.title = title;
|
|
7601
|
+
row2.updatedAt = this.now();
|
|
7005
7602
|
}
|
|
7006
7603
|
}
|
|
7007
7604
|
async updateThread(threadId, patch) {
|
|
7008
|
-
const
|
|
7009
|
-
if (
|
|
7605
|
+
const row2 = this.threads.get(threadId);
|
|
7606
|
+
if (row2 === void 0) {
|
|
7010
7607
|
return;
|
|
7011
7608
|
}
|
|
7012
7609
|
if (patch.title !== void 0) {
|
|
7013
|
-
|
|
7610
|
+
row2.title = patch.title;
|
|
7014
7611
|
}
|
|
7015
7612
|
if (patch.defaultAgent !== void 0) {
|
|
7016
|
-
|
|
7613
|
+
row2.defaultAgent = patch.defaultAgent;
|
|
7017
7614
|
}
|
|
7018
7615
|
if (patch.model !== void 0) {
|
|
7019
|
-
|
|
7616
|
+
row2.model = patch.model;
|
|
7020
7617
|
}
|
|
7021
7618
|
if (patch.persona !== void 0) {
|
|
7022
|
-
|
|
7619
|
+
row2.persona = patch.persona;
|
|
7023
7620
|
}
|
|
7024
|
-
|
|
7621
|
+
row2.updatedAt = this.now();
|
|
7025
7622
|
}
|
|
7026
7623
|
async activeRunForThread(threadId) {
|
|
7027
7624
|
return this.threads.get(threadId)?.activeStreamId ?? null;
|
|
@@ -7069,64 +7666,64 @@ var InMemoryAgentStore = class extends InMemoryActionProposalStore {
|
|
|
7069
7666
|
}
|
|
7070
7667
|
/** Settle a run's outcome. A no-op when the run is unknown (mirrors `setTitle`/`updateThread`). */
|
|
7071
7668
|
async recordRunEnd(end) {
|
|
7072
|
-
const
|
|
7073
|
-
if (
|
|
7669
|
+
const row2 = this.runs.get(end.runId);
|
|
7670
|
+
if (row2 === void 0) {
|
|
7074
7671
|
return;
|
|
7075
7672
|
}
|
|
7076
|
-
|
|
7077
|
-
|
|
7673
|
+
row2.status = end.status;
|
|
7674
|
+
row2.settledAt = this.now();
|
|
7078
7675
|
if (end.durationMs !== void 0) {
|
|
7079
|
-
|
|
7676
|
+
row2.durationMs = end.durationMs;
|
|
7080
7677
|
}
|
|
7081
7678
|
if (end.errorCode !== void 0) {
|
|
7082
|
-
|
|
7679
|
+
row2.errorCode = end.errorCode;
|
|
7083
7680
|
}
|
|
7084
7681
|
if (end.errorMessage !== void 0) {
|
|
7085
|
-
|
|
7682
|
+
row2.errorMessage = end.errorMessage;
|
|
7086
7683
|
}
|
|
7087
7684
|
}
|
|
7088
7685
|
/** Bump the run's llm-step retry counter. */
|
|
7089
7686
|
async bumpRunRetries(runId) {
|
|
7090
|
-
const
|
|
7091
|
-
if (
|
|
7092
|
-
|
|
7687
|
+
const row2 = this.runs.get(runId);
|
|
7688
|
+
if (row2 !== void 0) {
|
|
7689
|
+
row2.retries += 1;
|
|
7093
7690
|
}
|
|
7094
7691
|
}
|
|
7095
7692
|
async promoteThread(threadId) {
|
|
7096
|
-
const
|
|
7097
|
-
if (
|
|
7098
|
-
|
|
7099
|
-
|
|
7693
|
+
const row2 = this.threads.get(threadId);
|
|
7694
|
+
if (row2?.transient) {
|
|
7695
|
+
row2.transient = false;
|
|
7696
|
+
row2.updatedAt = this.now();
|
|
7100
7697
|
}
|
|
7101
7698
|
}
|
|
7102
7699
|
async setActiveStream(threadId, runId) {
|
|
7103
|
-
const
|
|
7104
|
-
if (
|
|
7700
|
+
const row2 = this.threads.get(threadId);
|
|
7701
|
+
if (row2 !== void 0) {
|
|
7105
7702
|
if (runId === null) {
|
|
7106
|
-
delete
|
|
7703
|
+
delete row2.activeStreamId;
|
|
7107
7704
|
} else {
|
|
7108
|
-
|
|
7705
|
+
row2.activeStreamId = runId;
|
|
7109
7706
|
}
|
|
7110
7707
|
}
|
|
7111
7708
|
}
|
|
7112
7709
|
async claimActiveStream(threadId, runId, options = {}) {
|
|
7113
|
-
const
|
|
7114
|
-
if (
|
|
7710
|
+
const row2 = this.threads.get(threadId);
|
|
7711
|
+
if (row2 === void 0) {
|
|
7115
7712
|
return false;
|
|
7116
7713
|
}
|
|
7117
|
-
const holder =
|
|
7714
|
+
const holder = row2.activeStreamId;
|
|
7118
7715
|
if (holder !== void 0 && holder !== runId && holder !== options.replacing) {
|
|
7119
7716
|
return false;
|
|
7120
7717
|
}
|
|
7121
|
-
|
|
7718
|
+
row2.activeStreamId = runId;
|
|
7122
7719
|
return true;
|
|
7123
7720
|
}
|
|
7124
7721
|
async releaseActiveStream(threadId, runId) {
|
|
7125
|
-
const
|
|
7126
|
-
if (
|
|
7722
|
+
const row2 = this.threads.get(threadId);
|
|
7723
|
+
if (row2?.activeStreamId !== runId) {
|
|
7127
7724
|
return false;
|
|
7128
7725
|
}
|
|
7129
|
-
delete
|
|
7726
|
+
delete row2.activeStreamId;
|
|
7130
7727
|
return true;
|
|
7131
7728
|
}
|
|
7132
7729
|
async enqueueMessage(input) {
|
|
@@ -7154,6 +7751,9 @@ var InMemoryAgentStore = class extends InMemoryActionProposalStore {
|
|
|
7154
7751
|
...input.uiCapabilities !== void 0 ? {
|
|
7155
7752
|
uiCapabilities: input.uiCapabilities
|
|
7156
7753
|
} : {},
|
|
7754
|
+
...input.hostContext !== void 0 ? {
|
|
7755
|
+
hostContext: input.hostContext
|
|
7756
|
+
} : {},
|
|
7157
7757
|
...input.interrupt === true ? {
|
|
7158
7758
|
interrupt: true
|
|
7159
7759
|
} : {},
|
|
@@ -7259,38 +7859,38 @@ var InMemoryAgentStore = class extends InMemoryActionProposalStore {
|
|
|
7259
7859
|
return void 0;
|
|
7260
7860
|
}
|
|
7261
7861
|
async getThreadActionProposalScope(threadId) {
|
|
7262
|
-
const
|
|
7263
|
-
return
|
|
7862
|
+
const row2 = this.threads.get(threadId);
|
|
7863
|
+
return row2 ? {
|
|
7264
7864
|
threadId,
|
|
7265
|
-
actorRef:
|
|
7266
|
-
tenantRef:
|
|
7865
|
+
actorRef: row2.actorRef,
|
|
7866
|
+
tenantRef: row2.tenantRef
|
|
7267
7867
|
} : null;
|
|
7268
7868
|
}
|
|
7269
7869
|
async admitActionProposalOutcome(command) {
|
|
7270
|
-
const
|
|
7870
|
+
const row2 = [
|
|
7271
7871
|
...this.rows.values()
|
|
7272
|
-
].find((
|
|
7273
|
-
if (!
|
|
7872
|
+
].find((row3) => row3.outcome?.id === command.outcomeId);
|
|
7873
|
+
if (!row2?.outcome || !row2.outcomeDelivery) return {
|
|
7274
7874
|
status: "not_found"
|
|
7275
7875
|
};
|
|
7276
|
-
if (
|
|
7876
|
+
if (row2.outcomeDelivery.status === "admitted") return {
|
|
7277
7877
|
status: "unchanged",
|
|
7278
|
-
...
|
|
7279
|
-
messageId:
|
|
7878
|
+
...row2.outcomeDelivery.messageId !== void 0 ? {
|
|
7879
|
+
messageId: row2.outcomeDelivery.messageId
|
|
7280
7880
|
} : {}
|
|
7281
7881
|
};
|
|
7282
|
-
if (
|
|
7882
|
+
if (row2.outcomeDelivery.status === "discarded") return {
|
|
7283
7883
|
status: "discarded"
|
|
7284
7884
|
};
|
|
7285
|
-
if (!actionProposalOutcomeFenceValid(
|
|
7885
|
+
if (!actionProposalOutcomeFenceValid(row2, command, this.clock())) return {
|
|
7286
7886
|
status: "conflict"
|
|
7287
7887
|
};
|
|
7288
|
-
const thread = this.threads.get(
|
|
7888
|
+
const thread = this.threads.get(row2.threadId);
|
|
7289
7889
|
if (!thread) {
|
|
7290
|
-
this.rows.set(
|
|
7291
|
-
...
|
|
7890
|
+
this.rows.set(row2.id, snapshotActionProposal({
|
|
7891
|
+
...row2,
|
|
7292
7892
|
outcomeDelivery: {
|
|
7293
|
-
...
|
|
7893
|
+
...row2.outcomeDelivery,
|
|
7294
7894
|
status: "discarded",
|
|
7295
7895
|
lease: null
|
|
7296
7896
|
}
|
|
@@ -7299,7 +7899,7 @@ var InMemoryAgentStore = class extends InMemoryActionProposalStore {
|
|
|
7299
7899
|
status: "discarded"
|
|
7300
7900
|
};
|
|
7301
7901
|
}
|
|
7302
|
-
if (thread.actorRef !==
|
|
7902
|
+
if (thread.actorRef !== row2.actorRef || thread.tenantRef !== row2.tenantRef) return {
|
|
7303
7903
|
status: "conflict"
|
|
7304
7904
|
};
|
|
7305
7905
|
if (thread.activeStreamId) return {
|
|
@@ -7308,15 +7908,15 @@ var InMemoryAgentStore = class extends InMemoryActionProposalStore {
|
|
|
7308
7908
|
const message = {
|
|
7309
7909
|
id: crypto.randomUUID(),
|
|
7310
7910
|
role: "assistant",
|
|
7311
|
-
content: actionProposalOutcomeText(
|
|
7911
|
+
content: actionProposalOutcomeText(row2.outcome),
|
|
7312
7912
|
createdAt: this.now(),
|
|
7313
|
-
actionProposalOutcome: snapshotActionProposal(
|
|
7314
|
-
ui: snapshotActionProposal(
|
|
7913
|
+
actionProposalOutcome: snapshotActionProposal(row2.outcome),
|
|
7914
|
+
ui: snapshotActionProposal(row2.outcome.ui)
|
|
7315
7915
|
};
|
|
7316
7916
|
const next = snapshotActionProposal({
|
|
7317
|
-
...
|
|
7917
|
+
...row2,
|
|
7318
7918
|
outcomeDelivery: {
|
|
7319
|
-
...
|
|
7919
|
+
...row2.outcomeDelivery,
|
|
7320
7920
|
status: "admitted",
|
|
7321
7921
|
lease: null,
|
|
7322
7922
|
messageId: message.id
|
|
@@ -7324,15 +7924,15 @@ var InMemoryAgentStore = class extends InMemoryActionProposalStore {
|
|
|
7324
7924
|
});
|
|
7325
7925
|
thread.messages.push(message);
|
|
7326
7926
|
thread.updatedAt = message.createdAt;
|
|
7327
|
-
this.rows.set(
|
|
7927
|
+
this.rows.set(row2.id, next);
|
|
7328
7928
|
return {
|
|
7329
7929
|
status: "applied",
|
|
7330
7930
|
messageId: message.id
|
|
7331
7931
|
};
|
|
7332
7932
|
}
|
|
7333
7933
|
async appendMessage(input) {
|
|
7334
|
-
const
|
|
7335
|
-
if (
|
|
7934
|
+
const row2 = this.threads.get(input.threadId);
|
|
7935
|
+
if (row2 === void 0) {
|
|
7336
7936
|
throw new Error(`thread ${input.threadId} not found`);
|
|
7337
7937
|
}
|
|
7338
7938
|
const message = {
|
|
@@ -7377,13 +7977,13 @@ var InMemoryAgentStore = class extends InMemoryActionProposalStore {
|
|
|
7377
7977
|
actionProposalOutcome: input.actionProposalOutcome
|
|
7378
7978
|
} : {}
|
|
7379
7979
|
};
|
|
7380
|
-
|
|
7381
|
-
|
|
7980
|
+
row2.messages.push(message);
|
|
7981
|
+
row2.updatedAt = message.createdAt;
|
|
7382
7982
|
return message;
|
|
7383
7983
|
}
|
|
7384
7984
|
async setMessageToolResults(messageId, results) {
|
|
7385
|
-
for (const
|
|
7386
|
-
const message =
|
|
7985
|
+
for (const row2 of this.threads.values()) {
|
|
7986
|
+
const message = row2.messages.find((candidate) => candidate.id === messageId);
|
|
7387
7987
|
if (message !== void 0) {
|
|
7388
7988
|
message.toolResults = results;
|
|
7389
7989
|
return;
|
|
@@ -7391,12 +7991,12 @@ var InMemoryAgentStore = class extends InMemoryActionProposalStore {
|
|
|
7391
7991
|
}
|
|
7392
7992
|
}
|
|
7393
7993
|
async setMessageUi(messageId, ui) {
|
|
7394
|
-
for (const
|
|
7395
|
-
const index =
|
|
7396
|
-
const message =
|
|
7994
|
+
for (const row2 of this.threads.values()) {
|
|
7995
|
+
const index = row2.messages.findIndex((candidate) => candidate.id === messageId);
|
|
7996
|
+
const message = row2.messages[index];
|
|
7397
7997
|
if (message !== void 0) {
|
|
7398
7998
|
const { ui: _previous, ...rest } = message;
|
|
7399
|
-
|
|
7999
|
+
row2.messages[index] = ui.length > 0 ? {
|
|
7400
8000
|
...rest,
|
|
7401
8001
|
ui
|
|
7402
8002
|
} : rest;
|
|
@@ -7408,12 +8008,12 @@ var InMemoryAgentStore = class extends InMemoryActionProposalStore {
|
|
|
7408
8008
|
return this.threadIdForMessage(messageId) ?? null;
|
|
7409
8009
|
}
|
|
7410
8010
|
async setMessageFeedback(messageId, feedback) {
|
|
7411
|
-
for (const
|
|
7412
|
-
const index =
|
|
7413
|
-
const message =
|
|
8011
|
+
for (const row2 of this.threads.values()) {
|
|
8012
|
+
const index = row2.messages.findIndex((candidate) => candidate.id === messageId);
|
|
8013
|
+
const message = row2.messages[index];
|
|
7414
8014
|
if (message !== void 0) {
|
|
7415
8015
|
const { feedback: _previous, ...rest } = message;
|
|
7416
|
-
|
|
8016
|
+
row2.messages[index] = feedback !== null ? {
|
|
7417
8017
|
...rest,
|
|
7418
8018
|
feedback
|
|
7419
8019
|
} : rest;
|
|
@@ -7422,13 +8022,13 @@ var InMemoryAgentStore = class extends InMemoryActionProposalStore {
|
|
|
7422
8022
|
}
|
|
7423
8023
|
}
|
|
7424
8024
|
async truncateFrom(threadId, messageId) {
|
|
7425
|
-
const
|
|
7426
|
-
if (
|
|
8025
|
+
const row2 = this.threads.get(threadId);
|
|
8026
|
+
if (row2 === void 0) {
|
|
7427
8027
|
return;
|
|
7428
8028
|
}
|
|
7429
|
-
const cutoff =
|
|
8029
|
+
const cutoff = row2.messages.findIndex((message) => message.id === messageId);
|
|
7430
8030
|
if (cutoff >= 0) {
|
|
7431
|
-
|
|
8031
|
+
row2.messages = row2.messages.slice(0, cutoff);
|
|
7432
8032
|
}
|
|
7433
8033
|
}
|
|
7434
8034
|
/**
|
|
@@ -7493,16 +8093,16 @@ var InMemoryAgentStore = class extends InMemoryActionProposalStore {
|
|
|
7493
8093
|
async toolCallOutcomes(toolCallIds) {
|
|
7494
8094
|
const outcomes = [];
|
|
7495
8095
|
for (const id of toolCallIds) {
|
|
7496
|
-
const
|
|
7497
|
-
if (
|
|
8096
|
+
const row2 = this.toolCalls.get(id);
|
|
8097
|
+
if (row2 !== void 0) {
|
|
7498
8098
|
outcomes.push({
|
|
7499
8099
|
id,
|
|
7500
|
-
status:
|
|
7501
|
-
...
|
|
7502
|
-
output:
|
|
8100
|
+
status: row2.status,
|
|
8101
|
+
...row2.output !== void 0 ? {
|
|
8102
|
+
output: row2.output
|
|
7503
8103
|
} : {},
|
|
7504
|
-
...
|
|
7505
|
-
error:
|
|
8104
|
+
...row2.error !== void 0 ? {
|
|
8105
|
+
error: row2.error
|
|
7506
8106
|
} : {}
|
|
7507
8107
|
});
|
|
7508
8108
|
}
|
|
@@ -7511,38 +8111,38 @@ var InMemoryAgentStore = class extends InMemoryActionProposalStore {
|
|
|
7511
8111
|
}
|
|
7512
8112
|
async failUnsettledToolCalls(runId, error) {
|
|
7513
8113
|
let settled = 0;
|
|
7514
|
-
for (const
|
|
7515
|
-
if (
|
|
7516
|
-
|
|
7517
|
-
|
|
8114
|
+
for (const row2 of this.toolCalls.values()) {
|
|
8115
|
+
if (row2.runId === runId && row2.status === "pending_approval") {
|
|
8116
|
+
row2.status = "failed";
|
|
8117
|
+
row2.error = error;
|
|
7518
8118
|
settled += 1;
|
|
7519
8119
|
}
|
|
7520
8120
|
}
|
|
7521
8121
|
return settled;
|
|
7522
8122
|
}
|
|
7523
8123
|
async updateToolCall(input) {
|
|
7524
|
-
const
|
|
7525
|
-
if (
|
|
8124
|
+
const row2 = this.toolCalls.get(input.toolCallId);
|
|
8125
|
+
if (row2 === void 0) {
|
|
7526
8126
|
return;
|
|
7527
8127
|
}
|
|
7528
|
-
|
|
8128
|
+
row2.status = input.status;
|
|
7529
8129
|
if (input.output !== void 0) {
|
|
7530
|
-
|
|
8130
|
+
row2.output = input.output;
|
|
7531
8131
|
}
|
|
7532
8132
|
if (input.error !== void 0) {
|
|
7533
|
-
|
|
8133
|
+
row2.error = input.error;
|
|
7534
8134
|
}
|
|
7535
8135
|
if (input.executionMs !== void 0) {
|
|
7536
|
-
|
|
8136
|
+
row2.executionMs = input.executionMs;
|
|
7537
8137
|
}
|
|
7538
8138
|
if (input.executedByRef !== void 0) {
|
|
7539
|
-
|
|
8139
|
+
row2.executedByRef = input.executedByRef;
|
|
7540
8140
|
}
|
|
7541
8141
|
if (input.remember !== void 0) {
|
|
7542
|
-
|
|
8142
|
+
row2.remember = input.remember;
|
|
7543
8143
|
}
|
|
7544
8144
|
if (input.decidedVia !== void 0) {
|
|
7545
|
-
|
|
8145
|
+
row2.decidedVia = input.decidedVia;
|
|
7546
8146
|
}
|
|
7547
8147
|
}
|
|
7548
8148
|
async recordUsage(input) {
|
|
@@ -7570,9 +8170,9 @@ var InMemoryAgentStore = class extends InMemoryActionProposalStore {
|
|
|
7570
8170
|
return this.usageBetween(actorRef, day, day);
|
|
7571
8171
|
}
|
|
7572
8172
|
async usageBetween(actorRef, fromDay, toDay) {
|
|
7573
|
-
const rows = this.usage.filter((
|
|
7574
|
-
const usedTokens = rows.reduce((sum,
|
|
7575
|
-
const costUsd = rows.reduce((sum,
|
|
8173
|
+
const rows = this.usage.filter((row2) => row2.actorRef === actorRef && row2.day >= fromDay && row2.day <= toDay);
|
|
8174
|
+
const usedTokens = rows.reduce((sum, row2) => sum + row2.inputTokens + row2.outputTokens, 0);
|
|
8175
|
+
const costUsd = rows.reduce((sum, row2) => sum + (row2.costUsd ?? 0), 0);
|
|
7576
8176
|
return {
|
|
7577
8177
|
usedTokens,
|
|
7578
8178
|
costUsd
|
|
@@ -7580,30 +8180,30 @@ var InMemoryAgentStore = class extends InMemoryActionProposalStore {
|
|
|
7580
8180
|
}
|
|
7581
8181
|
/** Test helper: read the recorded usage rows (modelId + token totals). */
|
|
7582
8182
|
usageRows() {
|
|
7583
|
-
return this.usage.map((
|
|
7584
|
-
actorRef:
|
|
7585
|
-
tokens:
|
|
7586
|
-
modelId:
|
|
8183
|
+
return this.usage.map((row2) => ({
|
|
8184
|
+
actorRef: row2.actorRef,
|
|
8185
|
+
tokens: row2.inputTokens + row2.outputTokens,
|
|
8186
|
+
modelId: row2.modelId
|
|
7587
8187
|
}));
|
|
7588
8188
|
}
|
|
7589
8189
|
/** Governance read-model feed: recorded usage rows with the input/output split + thread/day. */
|
|
7590
8190
|
governanceUsage() {
|
|
7591
|
-
return this.usage.map((
|
|
7592
|
-
actorRef:
|
|
7593
|
-
threadId:
|
|
7594
|
-
modelId:
|
|
7595
|
-
inputTokens:
|
|
7596
|
-
outputTokens:
|
|
7597
|
-
day:
|
|
7598
|
-
createdAt:
|
|
7599
|
-
...
|
|
7600
|
-
cacheWriteTokens:
|
|
8191
|
+
return this.usage.map((row2) => ({
|
|
8192
|
+
actorRef: row2.actorRef,
|
|
8193
|
+
threadId: row2.threadId,
|
|
8194
|
+
modelId: row2.modelId,
|
|
8195
|
+
inputTokens: row2.inputTokens,
|
|
8196
|
+
outputTokens: row2.outputTokens,
|
|
8197
|
+
day: row2.day,
|
|
8198
|
+
createdAt: row2.createdAt,
|
|
8199
|
+
...row2.cacheWriteTokens !== void 0 ? {
|
|
8200
|
+
cacheWriteTokens: row2.cacheWriteTokens
|
|
7601
8201
|
} : {},
|
|
7602
|
-
...
|
|
7603
|
-
cacheReadTokens:
|
|
8202
|
+
...row2.cacheReadTokens !== void 0 ? {
|
|
8203
|
+
cacheReadTokens: row2.cacheReadTokens
|
|
7604
8204
|
} : {},
|
|
7605
|
-
...
|
|
7606
|
-
costUsd:
|
|
8205
|
+
...row2.costUsd !== void 0 ? {
|
|
8206
|
+
costUsd: row2.costUsd
|
|
7607
8207
|
} : {}
|
|
7608
8208
|
}));
|
|
7609
8209
|
}
|
|
@@ -7611,22 +8211,22 @@ var InMemoryAgentStore = class extends InMemoryActionProposalStore {
|
|
|
7611
8211
|
governanceToolCalls() {
|
|
7612
8212
|
return [
|
|
7613
8213
|
...this.toolCalls.values()
|
|
7614
|
-
].map((
|
|
7615
|
-
toolCallId:
|
|
7616
|
-
toolName:
|
|
7617
|
-
toolType:
|
|
7618
|
-
status:
|
|
7619
|
-
threadId:
|
|
7620
|
-
messageId:
|
|
7621
|
-
createdAt:
|
|
7622
|
-
...
|
|
7623
|
-
executionMs:
|
|
8214
|
+
].map((row2) => ({
|
|
8215
|
+
toolCallId: row2.toolCallId,
|
|
8216
|
+
toolName: row2.toolName,
|
|
8217
|
+
toolType: row2.toolType,
|
|
8218
|
+
status: row2.status,
|
|
8219
|
+
threadId: row2.threadId,
|
|
8220
|
+
messageId: row2.messageId,
|
|
8221
|
+
createdAt: row2.createdAt,
|
|
8222
|
+
...row2.executionMs !== void 0 ? {
|
|
8223
|
+
executionMs: row2.executionMs
|
|
7624
8224
|
} : {},
|
|
7625
|
-
...
|
|
7626
|
-
error:
|
|
8225
|
+
...row2.error !== void 0 ? {
|
|
8226
|
+
error: row2.error
|
|
7627
8227
|
} : {},
|
|
7628
|
-
...
|
|
7629
|
-
runId:
|
|
8228
|
+
...row2.runId !== void 0 ? {
|
|
8229
|
+
runId: row2.runId
|
|
7630
8230
|
} : {}
|
|
7631
8231
|
}));
|
|
7632
8232
|
}
|
|
@@ -7686,51 +8286,51 @@ var InMemoryAgentStore = class extends InMemoryActionProposalStore {
|
|
|
7686
8286
|
governanceThreads() {
|
|
7687
8287
|
return [
|
|
7688
8288
|
...this.threads.values()
|
|
7689
|
-
].map((
|
|
7690
|
-
threadId:
|
|
7691
|
-
title:
|
|
7692
|
-
actorRef:
|
|
7693
|
-
messageCount:
|
|
7694
|
-
updatedAt:
|
|
8289
|
+
].map((row2) => ({
|
|
8290
|
+
threadId: row2.id,
|
|
8291
|
+
title: row2.title,
|
|
8292
|
+
actorRef: row2.actorRef,
|
|
8293
|
+
messageCount: row2.messages.length,
|
|
8294
|
+
updatedAt: row2.updatedAt
|
|
7695
8295
|
}));
|
|
7696
8296
|
}
|
|
7697
8297
|
/** Governance read-model feed: recorded run outcomes (the reliability surfaces). */
|
|
7698
8298
|
governanceRuns() {
|
|
7699
8299
|
return [
|
|
7700
8300
|
...this.runs.values()
|
|
7701
|
-
].map((
|
|
7702
|
-
runId:
|
|
7703
|
-
threadId:
|
|
7704
|
-
actorRef:
|
|
7705
|
-
status:
|
|
7706
|
-
retries:
|
|
7707
|
-
startedAt:
|
|
7708
|
-
...
|
|
7709
|
-
agentName:
|
|
8301
|
+
].map((row2) => ({
|
|
8302
|
+
runId: row2.runId,
|
|
8303
|
+
threadId: row2.threadId,
|
|
8304
|
+
actorRef: row2.actorRef,
|
|
8305
|
+
status: row2.status,
|
|
8306
|
+
retries: row2.retries,
|
|
8307
|
+
startedAt: row2.startedAt,
|
|
8308
|
+
...row2.agentName !== void 0 ? {
|
|
8309
|
+
agentName: row2.agentName
|
|
7710
8310
|
} : {},
|
|
7711
|
-
...
|
|
7712
|
-
parentRunId:
|
|
8311
|
+
...row2.parentRunId !== void 0 ? {
|
|
8312
|
+
parentRunId: row2.parentRunId
|
|
7713
8313
|
} : {},
|
|
7714
|
-
...
|
|
7715
|
-
durationMs:
|
|
8314
|
+
...row2.durationMs !== void 0 ? {
|
|
8315
|
+
durationMs: row2.durationMs
|
|
7716
8316
|
} : {},
|
|
7717
|
-
...
|
|
7718
|
-
errorCode:
|
|
8317
|
+
...row2.errorCode !== void 0 ? {
|
|
8318
|
+
errorCode: row2.errorCode
|
|
7719
8319
|
} : {},
|
|
7720
|
-
...
|
|
7721
|
-
errorMessage:
|
|
8320
|
+
...row2.errorMessage !== void 0 ? {
|
|
8321
|
+
errorMessage: row2.errorMessage
|
|
7722
8322
|
} : {},
|
|
7723
|
-
...
|
|
7724
|
-
settledAt:
|
|
8323
|
+
...row2.settledAt !== void 0 ? {
|
|
8324
|
+
settledAt: row2.settledAt
|
|
7725
8325
|
} : {},
|
|
7726
|
-
...
|
|
7727
|
-
promptHash:
|
|
8326
|
+
...row2.promptHash !== void 0 ? {
|
|
8327
|
+
promptHash: row2.promptHash
|
|
7728
8328
|
} : {}
|
|
7729
8329
|
}));
|
|
7730
8330
|
}
|
|
7731
8331
|
threadIdForMessage(messageId) {
|
|
7732
|
-
for (const [threadId,
|
|
7733
|
-
if (
|
|
8332
|
+
for (const [threadId, row2] of this.threads) {
|
|
8333
|
+
if (row2.messages.some((message) => message.id === messageId)) {
|
|
7734
8334
|
return threadId;
|
|
7735
8335
|
}
|
|
7736
8336
|
}
|
|
@@ -7740,54 +8340,54 @@ var InMemoryAgentStore = class extends InMemoryActionProposalStore {
|
|
|
7740
8340
|
toolCallRows() {
|
|
7741
8341
|
return [
|
|
7742
8342
|
...this.toolCalls.values()
|
|
7743
|
-
].map((
|
|
7744
|
-
toolCallId:
|
|
7745
|
-
toolName:
|
|
7746
|
-
toolType:
|
|
7747
|
-
status:
|
|
7748
|
-
input:
|
|
7749
|
-
...
|
|
7750
|
-
output:
|
|
8343
|
+
].map((row2) => ({
|
|
8344
|
+
toolCallId: row2.toolCallId,
|
|
8345
|
+
toolName: row2.toolName,
|
|
8346
|
+
toolType: row2.toolType,
|
|
8347
|
+
status: row2.status,
|
|
8348
|
+
input: row2.input,
|
|
8349
|
+
...row2.output !== void 0 ? {
|
|
8350
|
+
output: row2.output
|
|
7751
8351
|
} : {},
|
|
7752
|
-
...
|
|
7753
|
-
error:
|
|
8352
|
+
...row2.error !== void 0 ? {
|
|
8353
|
+
error: row2.error
|
|
7754
8354
|
} : {},
|
|
7755
|
-
...
|
|
7756
|
-
runId:
|
|
8355
|
+
...row2.runId !== void 0 ? {
|
|
8356
|
+
runId: row2.runId
|
|
7757
8357
|
} : {},
|
|
7758
|
-
...
|
|
7759
|
-
executedByRef:
|
|
8358
|
+
...row2.executedByRef !== void 0 ? {
|
|
8359
|
+
executedByRef: row2.executedByRef
|
|
7760
8360
|
} : {},
|
|
7761
|
-
...
|
|
7762
|
-
approver:
|
|
8361
|
+
...row2.approver !== void 0 ? {
|
|
8362
|
+
approver: row2.approver
|
|
7763
8363
|
} : {},
|
|
7764
|
-
...
|
|
7765
|
-
expiresAt:
|
|
8364
|
+
...row2.expiresAt !== void 0 ? {
|
|
8365
|
+
expiresAt: row2.expiresAt
|
|
7766
8366
|
} : {},
|
|
7767
|
-
...
|
|
7768
|
-
remember:
|
|
8367
|
+
...row2.remember !== void 0 ? {
|
|
8368
|
+
remember: row2.remember
|
|
7769
8369
|
} : {},
|
|
7770
|
-
...
|
|
7771
|
-
decidedVia:
|
|
8370
|
+
...row2.decidedVia !== void 0 ? {
|
|
8371
|
+
decidedVia: row2.decidedVia
|
|
7772
8372
|
} : {}
|
|
7773
8373
|
}));
|
|
7774
8374
|
}
|
|
7775
|
-
toSummary(
|
|
7776
|
-
const last =
|
|
8375
|
+
toSummary(row2) {
|
|
8376
|
+
const last = row2.messages[row2.messages.length - 1];
|
|
7777
8377
|
return {
|
|
7778
|
-
id:
|
|
7779
|
-
title:
|
|
7780
|
-
transient:
|
|
7781
|
-
createdAt:
|
|
7782
|
-
updatedAt:
|
|
8378
|
+
id: row2.id,
|
|
8379
|
+
title: row2.title,
|
|
8380
|
+
transient: row2.transient,
|
|
8381
|
+
createdAt: row2.createdAt,
|
|
8382
|
+
updatedAt: row2.updatedAt,
|
|
7783
8383
|
...last !== void 0 ? {
|
|
7784
8384
|
lastMessagePreview: last.content.slice(0, 120)
|
|
7785
8385
|
} : {},
|
|
7786
|
-
defaultAgent:
|
|
7787
|
-
...
|
|
7788
|
-
model:
|
|
8386
|
+
defaultAgent: row2.defaultAgent ?? null,
|
|
8387
|
+
...row2.model != null ? {
|
|
8388
|
+
model: row2.model
|
|
7789
8389
|
} : {},
|
|
7790
|
-
persona:
|
|
8390
|
+
persona: row2.persona ?? null
|
|
7791
8391
|
};
|
|
7792
8392
|
}
|
|
7793
8393
|
};
|
|
@@ -7795,22 +8395,22 @@ var InMemoryAgentStore = class extends InMemoryActionProposalStore {
|
|
|
7795
8395
|
// src/confirm-token.ts
|
|
7796
8396
|
import { createHash as createHash2, createHmac, timingSafeEqual } from "crypto";
|
|
7797
8397
|
var DEFAULT_CONFIRM_TTL_MS = 15 * 60 * 1e3;
|
|
7798
|
-
function
|
|
8398
|
+
function canonicalJson2(value) {
|
|
7799
8399
|
if (value === void 0) return "null";
|
|
7800
8400
|
if (value === null || typeof value !== "object") return JSON.stringify(value) ?? "null";
|
|
7801
|
-
if (Array.isArray(value)) return `[${value.map(
|
|
8401
|
+
if (Array.isArray(value)) return `[${value.map(canonicalJson2).join(",")}]`;
|
|
7802
8402
|
if (typeof value.toJSON === "function") {
|
|
7803
|
-
return
|
|
8403
|
+
return canonicalJson2(value.toJSON());
|
|
7804
8404
|
}
|
|
7805
8405
|
const entries = Object.entries(value).filter(([, entry]) => entry !== void 0).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0);
|
|
7806
|
-
return `{${entries.map(([key, entry]) => `${JSON.stringify(key)}:${
|
|
8406
|
+
return `{${entries.map(([key, entry]) => `${JSON.stringify(key)}:${canonicalJson2(entry)}`).join(",")}}`;
|
|
7807
8407
|
}
|
|
7808
|
-
__name(
|
|
8408
|
+
__name(canonicalJson2, "canonicalJson");
|
|
7809
8409
|
function signature(subject, expiresAt, secret) {
|
|
7810
8410
|
if (secret === "") {
|
|
7811
8411
|
throw new Error("confirm token: the secret is empty");
|
|
7812
8412
|
}
|
|
7813
|
-
return createHmac("sha256", secret).update(
|
|
8413
|
+
return createHmac("sha256", secret).update(canonicalJson2([
|
|
7814
8414
|
"agent-confirm",
|
|
7815
8415
|
subject.tool,
|
|
7816
8416
|
subject.actorId,
|
|
@@ -8138,8 +8738,8 @@ var SqlTokenStreamSink = class {
|
|
|
8138
8738
|
autoPurge;
|
|
8139
8739
|
writes = /* @__PURE__ */ new Map();
|
|
8140
8740
|
lastAutoPurge = 0;
|
|
8141
|
-
constructor(
|
|
8142
|
-
this.table =
|
|
8741
|
+
constructor(table2, options = {}) {
|
|
8742
|
+
this.table = table2;
|
|
8143
8743
|
this.pollIntervalMs = Math.max(1, options.pollIntervalMs ?? DEFAULT_POLL_INTERVAL_MS);
|
|
8144
8744
|
this.idlePollIntervalMs = Math.max(this.pollIntervalMs, options.idlePollIntervalMs ?? DEFAULT_IDLE_POLL_INTERVAL_MS);
|
|
8145
8745
|
this.flushMs = Math.max(0, options.flushMs ?? DEFAULT_FLUSH_MS);
|
|
@@ -8281,15 +8881,15 @@ var SqlTokenStreamSink = class {
|
|
|
8281
8881
|
let quietSince = Date.now();
|
|
8282
8882
|
while (true) {
|
|
8283
8883
|
const rows = await this.table.read(runId, cursor, READ_PAGE);
|
|
8284
|
-
for (const
|
|
8285
|
-
cursor =
|
|
8286
|
-
if (
|
|
8287
|
-
if (
|
|
8288
|
-
throw new AgentStreamError(JSON.parse(
|
|
8884
|
+
for (const row2 of rows) {
|
|
8885
|
+
cursor = row2.seq;
|
|
8886
|
+
if (row2.frame === null) {
|
|
8887
|
+
if (row2.error !== null) {
|
|
8888
|
+
throw new AgentStreamError(JSON.parse(row2.error));
|
|
8289
8889
|
}
|
|
8290
8890
|
return;
|
|
8291
8891
|
}
|
|
8292
|
-
yield encoder2.encode(
|
|
8892
|
+
yield encoder2.encode(row2.frame);
|
|
8293
8893
|
}
|
|
8294
8894
|
if (rows.length > 0) {
|
|
8295
8895
|
quietSince = Date.now();
|
|
@@ -8341,8 +8941,8 @@ var SqlTokenStreamSink = class {
|
|
|
8341
8941
|
};
|
|
8342
8942
|
|
|
8343
8943
|
// src/action-proposal-text.ts
|
|
8344
|
-
function resolveTextActionProposalDecision(text, proposals) {
|
|
8345
|
-
const command = parseTextActionProposalCommand(text);
|
|
8944
|
+
function resolveTextActionProposalDecision(text, proposals, vocabulary) {
|
|
8945
|
+
const command = parseTextActionProposalCommand(text, vocabulary);
|
|
8346
8946
|
if (command.status === "unmatched") return command;
|
|
8347
8947
|
const { decision, remember } = command;
|
|
8348
8948
|
const pending = proposals.filter((proposal) => proposal.decision === "pending");
|
|
@@ -8377,40 +8977,136 @@ function resolveTextActionProposalDecision(text, proposals) {
|
|
|
8377
8977
|
};
|
|
8378
8978
|
}
|
|
8379
8979
|
__name(resolveTextActionProposalDecision, "resolveTextActionProposalDecision");
|
|
8380
|
-
|
|
8980
|
+
var DEFAULT_TEXT_ACTION_PROPOSAL_VOCABULARY = {
|
|
8981
|
+
approve: [
|
|
8982
|
+
"yes",
|
|
8983
|
+
"confirm",
|
|
8984
|
+
"approve",
|
|
8985
|
+
"approved",
|
|
8986
|
+
"ok"
|
|
8987
|
+
],
|
|
8988
|
+
reject: [
|
|
8989
|
+
"no",
|
|
8990
|
+
"cancel",
|
|
8991
|
+
"reject",
|
|
8992
|
+
"deny"
|
|
8993
|
+
],
|
|
8994
|
+
remember: [
|
|
8995
|
+
"always in this conversation"
|
|
8996
|
+
]
|
|
8997
|
+
};
|
|
8998
|
+
var DEFAULT_TEXT_ACTION_PROPOSAL_REPLIES = {
|
|
8999
|
+
approved: "Proposal approved and queued to run.",
|
|
9000
|
+
rejected: "Proposal rejected; nothing was run.",
|
|
9001
|
+
expired: "The proposal expired; nothing was run.",
|
|
9002
|
+
unchanged: "This proposal could not be changed; refresh the list to see where it stands.",
|
|
9003
|
+
ambiguous: /* @__PURE__ */ __name((ids) => `Which proposal? Reply confirm #ID or cancel #ID: ${ids.join(", ")}`, "ambiguous"),
|
|
9004
|
+
tooMany: "There are several proposals. Confirm or reject one with an explicit #ID."
|
|
9005
|
+
};
|
|
9006
|
+
function textActionProposalReply(result2, decision, replies = DEFAULT_TEXT_ACTION_PROPOSAL_REPLIES) {
|
|
9007
|
+
return result2.status === "expired" || result2.proposal?.decision === "expired" ? replies.expired : result2.status === "applied" || result2.status === "unchanged" ? decision === "approved" ? replies.approved : replies.rejected : replies.unchanged;
|
|
9008
|
+
}
|
|
9009
|
+
__name(textActionProposalReply, "textActionProposalReply");
|
|
9010
|
+
var escapeRegExp = /* @__PURE__ */ __name((word) => word.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), "escapeRegExp");
|
|
9011
|
+
var alternatives = /* @__PURE__ */ __name((words) => words.map((word) => word.trim()).filter((word) => word.length > 0).map((word) => escapeRegExp(word).replace(/\s+/g, "\\s+")).join("|"), "alternatives");
|
|
9012
|
+
var fold = /* @__PURE__ */ __name((word) => word.trim().toLowerCase(), "fold");
|
|
9013
|
+
function parseTextActionProposalCommand(text, vocabulary = DEFAULT_TEXT_ACTION_PROPOSAL_VOCABULARY) {
|
|
8381
9014
|
if (/[\r\n]/u.test(text)) return {
|
|
8382
9015
|
status: "unmatched"
|
|
8383
9016
|
};
|
|
8384
|
-
const
|
|
8385
|
-
|
|
9017
|
+
const verbs = alternatives([
|
|
9018
|
+
...vocabulary.approve,
|
|
9019
|
+
...vocabulary.reject
|
|
9020
|
+
]);
|
|
9021
|
+
if (verbs.length === 0) return {
|
|
9022
|
+
status: "unmatched"
|
|
9023
|
+
};
|
|
9024
|
+
const remember = alternatives(vocabulary.remember);
|
|
9025
|
+
const match = new RegExp(`^(${verbs})${remember.length > 0 ? `(?: (${remember}))?` : "()"}(?: #([^\\s]+?))?[.!]?$`, "iu").exec(text.trim());
|
|
8386
9026
|
if (!match) return {
|
|
8387
9027
|
status: "unmatched"
|
|
8388
9028
|
};
|
|
8389
|
-
const verb = match[1]
|
|
9029
|
+
const verb = match[1] === void 0 ? void 0 : fold(match[1]);
|
|
8390
9030
|
if (verb === void 0) return {
|
|
8391
9031
|
status: "unmatched"
|
|
8392
9032
|
};
|
|
8393
|
-
const decision =
|
|
8394
|
-
|
|
8395
|
-
|
|
8396
|
-
"rejeito",
|
|
8397
|
-
"n\xE3o",
|
|
8398
|
-
"nao"
|
|
8399
|
-
].includes(verb) ? "rejected" : "approved";
|
|
8400
|
-
const remember = match[2] !== void 0;
|
|
8401
|
-
if (remember && decision !== "approved") return {
|
|
9033
|
+
const decision = vocabulary.reject.some((word) => fold(word) === verb) ? "rejected" : "approved";
|
|
9034
|
+
const remembers = match[2] !== void 0 && match[2] !== "";
|
|
9035
|
+
if (remembers && decision !== "approved") return {
|
|
8402
9036
|
status: "unmatched"
|
|
8403
9037
|
};
|
|
8404
9038
|
return {
|
|
8405
9039
|
status: "command",
|
|
8406
9040
|
decision,
|
|
8407
|
-
remember,
|
|
9041
|
+
remember: remembers,
|
|
8408
9042
|
...match[3] !== void 0 ? {
|
|
8409
9043
|
proposalId: match[3]
|
|
8410
9044
|
} : {}
|
|
8411
9045
|
};
|
|
8412
9046
|
}
|
|
8413
9047
|
__name(parseTextActionProposalCommand, "parseTextActionProposalCommand");
|
|
9048
|
+
var ptBrActionProposalText = {
|
|
9049
|
+
vocabulary: {
|
|
9050
|
+
approve: [
|
|
9051
|
+
"sim",
|
|
9052
|
+
"confirmo",
|
|
9053
|
+
"confirmar",
|
|
9054
|
+
"aprovar",
|
|
9055
|
+
"aprovo",
|
|
9056
|
+
"pode",
|
|
9057
|
+
...DEFAULT_TEXT_ACTION_PROPOSAL_VOCABULARY.approve
|
|
9058
|
+
],
|
|
9059
|
+
reject: [
|
|
9060
|
+
"n\xE3o",
|
|
9061
|
+
"nao",
|
|
9062
|
+
"cancelar",
|
|
9063
|
+
"cancela",
|
|
9064
|
+
"rejeitar",
|
|
9065
|
+
"rejeito",
|
|
9066
|
+
...DEFAULT_TEXT_ACTION_PROPOSAL_VOCABULARY.reject
|
|
9067
|
+
],
|
|
9068
|
+
remember: [
|
|
9069
|
+
"sempre nesta conversa",
|
|
9070
|
+
...DEFAULT_TEXT_ACTION_PROPOSAL_VOCABULARY.remember
|
|
9071
|
+
]
|
|
9072
|
+
},
|
|
9073
|
+
replies: {
|
|
9074
|
+
approved: "Proposta aprovada e enfileirada para execu\xE7\xE3o.",
|
|
9075
|
+
rejected: "Proposta rejeitada; nenhuma a\xE7\xE3o foi executada.",
|
|
9076
|
+
expired: "A proposta expirou; nenhuma a\xE7\xE3o foi executada.",
|
|
9077
|
+
unchanged: "N\xE3o foi poss\xEDvel alterar esta proposta; atualize a lista para consultar seu estado.",
|
|
9078
|
+
ambiguous: /* @__PURE__ */ __name((ids) => `Qual proposta? Responda confirmar #ID ou cancelar #ID: ${ids.join(", ")}`, "ambiguous"),
|
|
9079
|
+
tooMany: "H\xE1 v\xE1rias propostas. Confirme ou rejeite usando #ID expl\xEDcito."
|
|
9080
|
+
}
|
|
9081
|
+
};
|
|
9082
|
+
|
|
9083
|
+
// src/action-proposal-view.ts
|
|
9084
|
+
function toActionProposalView(proposal) {
|
|
9085
|
+
const { execution, outcomeDelivery, idempotencyKey: _idempotencyKey, preparationInput: _preparationInput, executionContext: _executionContext, ...rest } = proposal;
|
|
9086
|
+
return {
|
|
9087
|
+
...rest,
|
|
9088
|
+
execution: execution === null ? null : withoutLease(execution),
|
|
9089
|
+
...outcomeDelivery !== void 0 ? {
|
|
9090
|
+
outcomeDelivery: withoutLease(outcomeDelivery)
|
|
9091
|
+
} : {}
|
|
9092
|
+
};
|
|
9093
|
+
}
|
|
9094
|
+
__name(toActionProposalView, "toActionProposalView");
|
|
9095
|
+
function toActionProposalMutationView(result2) {
|
|
9096
|
+
const { proposal, ...rest } = result2;
|
|
9097
|
+
return {
|
|
9098
|
+
...rest,
|
|
9099
|
+
...proposal !== void 0 ? {
|
|
9100
|
+
proposal: toActionProposalView(proposal)
|
|
9101
|
+
} : {}
|
|
9102
|
+
};
|
|
9103
|
+
}
|
|
9104
|
+
__name(toActionProposalMutationView, "toActionProposalMutationView");
|
|
9105
|
+
function withoutLease(value) {
|
|
9106
|
+
const { lease: _lease, ...rest } = value;
|
|
9107
|
+
return rest;
|
|
9108
|
+
}
|
|
9109
|
+
__name(withoutLease, "withoutLease");
|
|
8414
9110
|
|
|
8415
9111
|
// src/action-proposal-executor.ts
|
|
8416
9112
|
var ActionProposalExecutor = class {
|
|
@@ -8642,6 +9338,37 @@ function assertIndependentActionCapabilities(store, resolver) {
|
|
|
8642
9338
|
if (required.some((method) => typeof candidate[method] !== "function")) throw new Error("Independent action mode requires proposal, worker, outcome and admission capabilities on the conversation store");
|
|
8643
9339
|
}
|
|
8644
9340
|
__name(assertIndependentActionCapabilities, "assertIndependentActionCapabilities");
|
|
9341
|
+
|
|
9342
|
+
// src/functional-tool.ts
|
|
9343
|
+
function createFunctionalTool(definition) {
|
|
9344
|
+
const { input, execute, present, preflight, isEnabled, canUse, describe, kind, ...metadata } = definition;
|
|
9345
|
+
return {
|
|
9346
|
+
spec: {
|
|
9347
|
+
...metadata,
|
|
9348
|
+
kind: kind ?? "read",
|
|
9349
|
+
inputSchema: input
|
|
9350
|
+
},
|
|
9351
|
+
handler: {
|
|
9352
|
+
execute: execute.bind(definition),
|
|
9353
|
+
...present === void 0 ? {} : {
|
|
9354
|
+
present: present.bind(definition)
|
|
9355
|
+
},
|
|
9356
|
+
...preflight === void 0 ? {} : {
|
|
9357
|
+
preflight: preflight.bind(definition)
|
|
9358
|
+
},
|
|
9359
|
+
...isEnabled === void 0 ? {} : {
|
|
9360
|
+
isEnabled: isEnabled.bind(definition)
|
|
9361
|
+
},
|
|
9362
|
+
...canUse === void 0 ? {} : {
|
|
9363
|
+
canUse: canUse.bind(definition)
|
|
9364
|
+
},
|
|
9365
|
+
...describe === void 0 ? {} : {
|
|
9366
|
+
describe: describe.bind(definition)
|
|
9367
|
+
}
|
|
9368
|
+
}
|
|
9369
|
+
};
|
|
9370
|
+
}
|
|
9371
|
+
__name(createFunctionalTool, "createFunctionalTool");
|
|
8645
9372
|
export {
|
|
8646
9373
|
AGENT_ACTOR_DIRECTORY,
|
|
8647
9374
|
AGENT_ACTOR_RESOLVER,
|
|
@@ -8691,6 +9418,8 @@ export {
|
|
|
8691
9418
|
DEFAULT_MAX_SKILLS,
|
|
8692
9419
|
DEFAULT_REFUSAL_REASON,
|
|
8693
9420
|
DEFAULT_STRUCTURED_OUTPUT_INSTRUCTION,
|
|
9421
|
+
DEFAULT_TEXT_ACTION_PROPOSAL_REPLIES,
|
|
9422
|
+
DEFAULT_TEXT_ACTION_PROPOSAL_VOCABULARY,
|
|
8694
9423
|
DEFAULT_TOOL_TRANSIENT_RETRY_ATTEMPTS,
|
|
8695
9424
|
DEFAULT_TOOL_TRANSIENT_RETRY_BACKOFF_MS,
|
|
8696
9425
|
DefaultApprovalPolicy,
|
|
@@ -8748,12 +9477,13 @@ export {
|
|
|
8748
9477
|
buildSkillsBlock,
|
|
8749
9478
|
canActorUseTool,
|
|
8750
9479
|
canonicalActionProposalJson,
|
|
8751
|
-
canonicalJson,
|
|
9480
|
+
canonicalJson2 as canonicalJson,
|
|
8752
9481
|
claimActionProposalOutcome,
|
|
8753
9482
|
closeEmptyRoles,
|
|
8754
9483
|
compositeSkillProvider,
|
|
8755
9484
|
confirmTokenExpiry,
|
|
8756
9485
|
createFrameBuffer,
|
|
9486
|
+
createFunctionalTool,
|
|
8757
9487
|
createIncrementalGate,
|
|
8758
9488
|
createNegotiatedUiCollector,
|
|
8759
9489
|
createNoopEmitUi,
|
|
@@ -8767,6 +9497,7 @@ export {
|
|
|
8767
9497
|
detachedDelivered,
|
|
8768
9498
|
detachedStarted,
|
|
8769
9499
|
detachedUnsettled,
|
|
9500
|
+
emitToolPresentations,
|
|
8770
9501
|
encodeStreamEvent,
|
|
8771
9502
|
escapeUnsafeToolUiText,
|
|
8772
9503
|
estimateCost,
|
|
@@ -8805,6 +9536,7 @@ export {
|
|
|
8805
9536
|
parseTextActionProposalCommand,
|
|
8806
9537
|
personaCatalogEntry,
|
|
8807
9538
|
prepareActionProposal,
|
|
9539
|
+
ptBrActionProposalText,
|
|
8808
9540
|
publishAgentDelegated,
|
|
8809
9541
|
publishAgentMemoryResolved,
|
|
8810
9542
|
publishAgentMemoryWritten,
|
|
@@ -8861,6 +9593,9 @@ export {
|
|
|
8861
9593
|
streamFailure,
|
|
8862
9594
|
summarizeWithModel,
|
|
8863
9595
|
tenantScope,
|
|
9596
|
+
textActionProposalReply,
|
|
9597
|
+
toActionProposalMutationView,
|
|
9598
|
+
toActionProposalView,
|
|
8864
9599
|
toolCallApprovalFromRow,
|
|
8865
9600
|
toolCallContext,
|
|
8866
9601
|
traceLlmTurn,
|