@sema-agent/client-core 0.97.0 → 0.98.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/CHANGELOG.md +429 -0
- package/README.md +74 -36
- package/dist/adapt/arms.d.ts +1 -0
- package/dist/adapt/arms.js +128 -34
- package/dist/adapt/ids.d.ts +12 -1
- package/dist/adapt/ids.js +59 -8
- package/dist/adapt/instanceLedger.d.ts +50 -0
- package/dist/adapt/instanceLedger.js +147 -0
- package/dist/adapt/textStream.d.ts +1 -0
- package/dist/adapt/textStream.js +24 -7
- package/dist/adapt/toolCards.d.ts +27 -5
- package/dist/adapt/toolCards.js +39 -6
- package/dist/adapt/wireShapes.js +6 -2
- package/dist/adapt.d.ts +2 -0
- package/dist/adapt.js +8 -3
- package/dist/adapter/activeRunSelfHeal.d.ts +5 -0
- package/dist/adapter/activeRunSelfHeal.js +51 -28
- package/dist/adapter/downstream/eventToSdkMessage.d.ts +2 -5
- package/dist/adapter/downstream/eventToSdkMessage.js +27 -34
- package/dist/adapter/downstream/terminalToSdkResult.js +11 -4
- package/dist/adapter/downstream/turnUsageToModelUsage.d.ts +5 -2
- package/dist/adapter/downstream/turnUsageToModelUsage.js +2 -0
- package/dist/adapter/runStream.js +29 -13
- package/dist/adapter/types.d.ts +4 -4
- package/dist/agentSession/backgroundView.js +2 -1
- package/dist/agentSession/engineAgentRegistryRead.d.ts +2 -2
- package/dist/agentSession/engineAgentRegistryRead.js +12 -13
- package/dist/agentsWireCaps.d.ts +8 -6
- package/dist/agentsWireCaps.js +177 -162
- package/dist/approvalDecidedByCapability.d.ts +0 -4
- package/dist/approvalDecidedByCapability.js +0 -6
- package/dist/approvalsStreamLiveCapability.d.ts +0 -4
- package/dist/approvalsStreamLiveCapability.js +0 -6
- package/dist/assistantInbox.d.ts +34 -0
- package/dist/assistantInbox.js +118 -0
- package/dist/centerWiringCapability.js +9 -1
- package/dist/clientSlice.d.ts +0 -9
- package/dist/clientSlice.js +0 -3
- package/dist/cloudConfigWireCaps.d.ts +4 -2
- package/dist/cloudConfigWireCaps.js +81 -61
- package/dist/compensations.js +1 -1
- package/dist/connectorStatus.d.ts +21 -0
- package/dist/connectorStatus.js +112 -0
- package/dist/controlRouter.d.ts +14 -1
- package/dist/controlRouter.js +68 -17
- package/dist/coreValuePorts.d.ts +3 -3
- package/dist/decideReceipt.d.ts +2 -2
- package/dist/decideReceipt.js +5 -2
- package/dist/declared/supportFloorDeclared.js +3 -3
- package/dist/deviceExecutorManagementCapability.d.ts +0 -4
- package/dist/deviceExecutorManagementCapability.js +0 -6
- package/dist/deviceRebind.d.ts +49 -1
- package/dist/deviceRebind.js +221 -3
- package/dist/displayUntrusted.d.ts +1 -0
- package/dist/displayUntrusted.js +250 -76
- package/dist/engineAgentAbsence.d.ts +1 -1
- package/dist/engineAgentPanelStore.d.ts +5 -4
- package/dist/engineAgentPanelStore.js +3 -12
- package/dist/engineCapReader.d.ts +0 -4
- package/dist/engineCapReader.js +1 -5
- package/dist/engineCapsCache.d.ts +4 -0
- package/dist/engineCapsCache.js +17 -12
- package/dist/engineClosedSets.d.ts +1 -0
- package/dist/engineClosedSets.js +4 -1
- package/dist/engineErrorCodes.d.ts +9 -2
- package/dist/engineErrorCodes.js +9 -1
- package/dist/engineIdentity.d.ts +1 -0
- package/dist/engineIdentity.js +8 -0
- package/dist/engineRowRef.d.ts +28 -0
- package/dist/engineRowRef.js +111 -0
- package/dist/engineSessionMessages.d.ts +67 -0
- package/dist/engineSessionMessages.js +364 -0
- package/dist/engineToolDirectory.d.ts +18 -0
- package/dist/engineToolDirectory.js +85 -0
- package/dist/engineUrl.d.ts +18 -0
- package/dist/engineUrl.js +52 -0
- package/dist/env/uiLanguage.d.ts +9 -0
- package/dist/env/uiLanguage.js +35 -0
- package/dist/eventLeg.d.ts +92 -0
- package/dist/eventLeg.js +285 -0
- package/dist/executionLaneCapability.d.ts +0 -4
- package/dist/executionLaneCapability.js +3 -16
- package/dist/fileHistoryCaptureCapability.d.ts +0 -4
- package/dist/fileHistoryCaptureCapability.js +5 -7
- package/dist/fleet/fleetLedger.d.ts +0 -3
- package/dist/fleet/fleetLedger.js +21 -36
- package/dist/fleet/fleetProjection.d.ts +2 -2
- package/dist/fleet/fleetProjection.js +10 -8
- package/dist/frameBinding.d.ts +5 -0
- package/dist/frameBinding.js +23 -0
- package/dist/gateFailureCodes.d.ts +2 -0
- package/dist/gateFailureCodes.js +15 -0
- package/dist/gateOutcome.d.ts +3 -1
- package/dist/gateOutcome.js +25 -6
- package/dist/gateVocabulary.d.ts +5 -0
- package/dist/gateVocabulary.js +64 -2
- package/dist/generated/engineAskFaceTables.js +2 -2
- package/dist/generated/engineFactTables.d.ts +6 -3
- package/dist/generated/engineFactTables.js +22 -4
- package/dist/generated/engineNoticeTables.js +9 -0
- package/dist/generated/toolNameTables.d.ts +1 -0
- package/dist/generated/toolNameTables.js +1 -0
- package/dist/hitl/allowRuleShadow.d.ts +6 -1
- package/dist/hitl/allowRuleShadow.js +21 -17
- package/dist/hitl/approvalCardReading.d.ts +15 -0
- package/dist/hitl/approvalCardReading.js +154 -0
- package/dist/hitl/approvalCardReasons.d.ts +13 -0
- package/dist/hitl/approvalCardReasons.js +120 -0
- package/dist/hitl/approvalHolds.d.ts +47 -15
- package/dist/hitl/approvalHolds.js +134 -28
- package/dist/hitl/approvalResolution.d.ts +51 -26
- package/dist/hitl/approvalResolution.js +86 -122
- package/dist/hitl/approvalsFeed.js +6 -18
- package/dist/hitl/askClassPair.d.ts +2 -0
- package/dist/hitl/askClassPair.js +1 -0
- package/dist/hitl/askGateWire.d.ts +20 -2
- package/dist/hitl/askGateWire.js +49 -1
- package/dist/hitl/askParkRowRouting.d.ts +5 -0
- package/dist/hitl/askParkRowRouting.js +32 -1
- package/dist/hitl/askSettlementLine.d.ts +18 -0
- package/dist/hitl/askSettlementLine.js +79 -0
- package/dist/hitl/automaticAnswerVerdict.d.ts +1 -1
- package/dist/hitl/automaticAnswerVerdict.js +21 -5
- package/dist/hitl/crashConverged.d.ts +11 -20
- package/dist/hitl/crashConverged.js +56 -0
- package/dist/hitl/crashConvergedNotice.d.ts +3 -1
- package/dist/hitl/crashConvergedNotice.js +48 -11
- package/dist/hitl/decisionConflict.js +3 -10
- package/dist/hitl/decisionRefusal.d.ts +40 -1
- package/dist/hitl/decisionRefusal.js +199 -42
- package/dist/hitl/frameRouter.d.ts +5 -2
- package/dist/hitl/frameRouter.js +20 -16
- package/dist/hitl/gateLedger.d.ts +2 -0
- package/dist/hitl/gateLedger.js +50 -13
- package/dist/hitl/hitlBridge.d.ts +1 -2
- package/dist/hitl/hitlBridge.js +10 -7
- package/dist/hitl/livePendingAsk.d.ts +3 -3
- package/dist/hitl/livePendingAsk.js +7 -18
- package/dist/hitl/parkResolver.d.ts +2 -24
- package/dist/hitl/parkResolver.js +61 -97
- package/dist/hitl/persistedRulesWire.d.ts +24 -0
- package/dist/hitl/persistedRulesWire.js +122 -2
- package/dist/hitl/planReviewWire.d.ts +26 -13
- package/dist/hitl/planReviewWire.js +112 -78
- package/dist/hitl/refusedToolNameProse.d.ts +0 -1
- package/dist/hitl/refusedToolNameProse.js +0 -3
- package/dist/hitl/replayedApproval.d.ts +4 -3
- package/dist/hitl/replayedApproval.js +7 -4
- package/dist/hitl/sessionPolicyDeliverable.js +2 -4
- package/dist/hitl/sessionPolicyWire.d.ts +32 -20
- package/dist/hitl/sessionPolicyWire.js +162 -52
- package/dist/hitl/standingRows.d.ts +20 -2
- package/dist/hitl/standingRows.js +69 -8
- package/dist/hitl/toolApprovalWire.d.ts +87 -152
- package/dist/hitl/toolApprovalWire.js +591 -380
- package/dist/hookMatcherVerdict.d.ts +6 -1
- package/dist/hookMatcherVerdict.js +14 -7
- package/dist/hooksWireCaps.d.ts +2 -2
- package/dist/hooksWireCaps.js +59 -55
- package/dist/i18n/messages.en.d.ts +121 -0
- package/dist/i18n/messages.en.js +119 -0
- package/dist/i18n/messages.zh.d.ts +3 -0
- package/dist/i18n/messages.zh.js +120 -0
- package/dist/i18n/translate.d.ts +25 -0
- package/dist/i18n/translate.js +127 -0
- package/dist/index.d.ts +53 -18
- package/dist/index.js +38 -10
- package/dist/inheritEnvCapability.d.ts +31 -0
- package/dist/inheritEnvCapability.js +104 -0
- package/dist/liveModelCatalog.d.ts +1 -2
- package/dist/liveModelCatalog.js +2 -6
- package/dist/liveQuestionStore.d.ts +2 -21
- package/dist/mcpLiveness.d.ts +2 -1
- package/dist/mcpProbeWire.d.ts +6 -1
- package/dist/mcpProbeWire.js +1 -1
- package/dist/mcpWireCaps.d.ts +13 -2
- package/dist/mcpWireCaps.js +48 -0
- package/dist/memoryEntriesWire.d.ts +4 -9
- package/dist/model/modelSupplyRules.d.ts +0 -2
- package/dist/model/modelSupplyRules.js +3 -12
- package/dist/model/modelsPolicy.d.ts +0 -5
- package/dist/model/modelsPolicy.js +6 -36
- package/dist/model/subagentModelWord.d.ts +31 -0
- package/dist/model/subagentModelWord.js +261 -0
- package/dist/notifications.d.ts +6 -0
- package/dist/notifications.js +71 -23
- package/dist/outputStyleSeatCapability.d.ts +0 -3
- package/dist/outputStyleSeatCapability.js +0 -3
- package/dist/ownKey.d.ts +15 -0
- package/dist/ownKey.js +60 -3
- package/dist/panelReduce.d.ts +15 -9
- package/dist/panelReduce.js +680 -549
- package/dist/panelStateHolder.d.ts +3 -7
- package/dist/panelStateHolder.js +14 -130
- package/dist/peerLaneCapability.d.ts +0 -4
- package/dist/peerLaneCapability.js +0 -6
- package/dist/permissionRulesWriteCapability.d.ts +0 -4
- package/dist/permissionRulesWriteCapability.js +0 -6
- package/dist/permissionWireCaps.d.ts +2 -2
- package/dist/permissionWireCaps.js +2 -0
- package/dist/permissionsAllowGrantCapability.d.ts +0 -4
- package/dist/permissionsAllowGrantCapability.js +0 -6
- package/dist/permissionsDeclaration.d.ts +0 -11
- package/dist/permissionsDeclaration.js +60 -53
- package/dist/pluginHooksWire.d.ts +1 -1
- package/dist/pluginHooksWire.js +3 -6
- package/dist/preemptWire.d.ts +44 -0
- package/dist/preemptWire.js +83 -0
- package/dist/printToolResultFrame.js +15 -4
- package/dist/replayBody.d.ts +3 -0
- package/dist/replayBody.js +14 -0
- package/dist/request/taskRequest.d.ts +0 -1
- package/dist/request/taskRequest.js +0 -3
- package/dist/resumeRefusalCopy.d.ts +2 -1
- package/dist/resumeRefusalCopy.js +38 -2
- package/dist/retryStatus.d.ts +8 -0
- package/dist/retryStatus.js +106 -1
- package/dist/rewindArchiveCapability.d.ts +0 -4
- package/dist/rewindArchiveCapability.js +2 -10
- package/dist/rewindArchiveReading.d.ts +0 -1
- package/dist/rewindArchiveReading.js +0 -3
- package/dist/runCancelContext.d.ts +2 -1
- package/dist/runCancelContext.js +4 -2
- package/dist/runReattachPolicy.d.ts +31 -0
- package/dist/runReattachPolicy.js +46 -0
- package/dist/runTerminal.d.ts +3 -6
- package/dist/runTerminal.js +8 -9
- package/dist/sandboxWire.d.ts +3 -1
- package/dist/sandboxWire.js +76 -27
- package/dist/scenarioWire.js +1 -1
- package/dist/seam.d.ts +24 -2
- package/dist/seam.js +15 -3
- package/dist/seatContract.d.ts +53 -10
- package/dist/seatContract.js +132 -81
- package/dist/sessionPolicyCapability.d.ts +0 -4
- package/dist/sessionPolicyCapability.js +0 -6
- package/dist/sessionSyncFileHistoryCapability.d.ts +0 -3
- package/dist/sessionSyncFileHistoryCapability.js +0 -3
- package/dist/skillToolListsCapability.d.ts +0 -3
- package/dist/skillToolListsCapability.js +0 -3
- package/dist/sqlEngineCapability.d.ts +0 -4
- package/dist/sqlEngineCapability.js +0 -6
- package/dist/steerPriorityCapability.d.ts +0 -3
- package/dist/steerPriorityCapability.js +0 -3
- package/dist/streamDrainingLegs.d.ts +4 -0
- package/dist/streamDrainingLegs.js +6 -1
- package/dist/subagent/engineCompactWire.d.ts +0 -1
- package/dist/subagent/engineCompactWire.js +7 -5
- package/dist/subagent/engineTaskHandleWire.js +4 -7
- package/dist/subagentContentStore.js +1 -11
- package/dist/submitReopen.d.ts +24 -0
- package/dist/submitReopen.js +75 -0
- package/dist/terminalStatuses.d.ts +3 -0
- package/dist/terminalStatuses.js +10 -2
- package/dist/toolResult.d.ts +10 -1
- package/dist/toolResult.js +34 -6
- package/dist/toolRoster.d.ts +0 -2
- package/dist/toolRoster.js +0 -2
- package/dist/turnFailurePresentation.d.ts +28 -0
- package/dist/turnFailurePresentation.js +205 -0
- package/dist/userInvokedSkillsCapability.d.ts +0 -3
- package/dist/userInvokedSkillsCapability.js +0 -3
- package/dist/webSearchBackendCapability.d.ts +0 -4
- package/dist/webSearchBackendCapability.js +0 -6
- package/dist/wireErrorTriage.js +5 -24
- package/dist/wireFailureShape.d.ts +62 -5
- package/dist/wireFailureShape.js +105 -5
- package/dist/wireRefusalCopy.d.ts +12 -2
- package/dist/wireRefusalCopy.js +50 -52
- package/dist/workflowsJournalCapability.d.ts +0 -4
- package/dist/workflowsJournalCapability.js +0 -6
- package/dist/writeProtectionCapability.d.ts +0 -4
- package/dist/writeProtectionCapability.js +0 -6
- package/docs/INTEGRATION-CLIENTS.md +1305 -46
- package/package.json +5 -4
- package/dist/attachmentSeatCapability.d.ts +0 -12
- package/dist/attachmentSeatCapability.js +0 -23
- package/dist/hitl/approvalOutcomeNote.d.ts +0 -10
- package/dist/hitl/approvalOutcomeNote.js +0 -29
- package/dist/sessionReadRedactionCapability.d.ts +0 -13
- package/dist/sessionReadRedactionCapability.js +0 -35
package/dist/agentsWireCaps.js
CHANGED
|
@@ -1,20 +1,18 @@
|
|
|
1
1
|
import { hostEnv } from './hostEnv.js';
|
|
2
|
-
import { ownDataField } from './ownKey.js';
|
|
3
2
|
import { makeEngineWireClient } from './engineWireSdk.js';
|
|
4
3
|
import { frozenSet } from './frozenSet.js';
|
|
5
4
|
import { settleWithinDeadline } from './abortableSleep.js';
|
|
5
|
+
import { engineCapValue, engineCapValueVia, engineCapsGeneration, engineCapsLandingOf, engineCapsSettled, kickEngineCapsProbe } from './engineCapsCache.js';
|
|
6
6
|
import { ruleToolNameVerdictOf } from './protocolSegment.js';
|
|
7
7
|
import { CORE_PROTOCOL_PREFIXES } from './generated/toolNameTables.js';
|
|
8
8
|
import { rosterMountedNames } from './rosterMountedNames.js';
|
|
9
9
|
import { capForDisplay } from './fleetTaskDesc.js';
|
|
10
|
+
import { deniedEntryToolName } from './engineToolDirectory.js';
|
|
11
|
+
import { assemblyRefusal } from './wireFailureShape.js';
|
|
10
12
|
export const MAX_TASK_AGENTS = 32;
|
|
11
|
-
export const MAX_AGENT_NAME_CHARS = 64;
|
|
12
13
|
export const MAX_AGENT_TEXT_CHARS = 4_096;
|
|
13
14
|
export const MAX_AGENT_SYSTEM_PROMPT_CHARS = 65_536;
|
|
14
|
-
export const MAX_AGENT_TOOLS = 64;
|
|
15
|
-
export const MAX_AGENT_TOOL_NAME_CHARS = 128;
|
|
16
15
|
export const MAX_AGENT_SKILL_CONTENT_CHARS = 1_048_576;
|
|
17
|
-
export const MAX_AGENT_MAX_TURNS = 1_000;
|
|
18
16
|
export const TASK_AGENT_WIRE_FIELDS = [
|
|
19
17
|
'name',
|
|
20
18
|
'whenToUse',
|
|
@@ -43,31 +41,6 @@ const SOURCE_RANK = {
|
|
|
43
41
|
function sourceRank(source) {
|
|
44
42
|
return SOURCE_RANK[source] ?? 5;
|
|
45
43
|
}
|
|
46
|
-
function unescapedIndexOf(s, ch, last) {
|
|
47
|
-
for (let k = 0; k < s.length; k++) {
|
|
48
|
-
const i = last ? s.length - 1 - k : k;
|
|
49
|
-
if (s[i] !== ch)
|
|
50
|
-
continue;
|
|
51
|
-
let backslashes = 0;
|
|
52
|
-
for (let j = i - 1; j >= 0 && s[j] === '\\'; j--)
|
|
53
|
-
backslashes++;
|
|
54
|
-
if (backslashes % 2 === 0)
|
|
55
|
-
return i;
|
|
56
|
-
}
|
|
57
|
-
return -1;
|
|
58
|
-
}
|
|
59
|
-
function deniedEntryToolName(entry) {
|
|
60
|
-
if (entry !== entry.trim())
|
|
61
|
-
return undefined;
|
|
62
|
-
const open = unescapedIndexOf(entry, '(', false);
|
|
63
|
-
if (open === -1)
|
|
64
|
-
return entry;
|
|
65
|
-
const close = unescapedIndexOf(entry, ')', true);
|
|
66
|
-
if (close === -1 || close <= open || close !== entry.length - 1)
|
|
67
|
-
return entry;
|
|
68
|
-
const name = entry.substring(0, open);
|
|
69
|
-
return name.length === 0 ? entry : name.trim();
|
|
70
|
-
}
|
|
71
44
|
function toolNameFlawOf(entry, names, list) {
|
|
72
45
|
if (typeof entry !== 'string' || entry.length === 0 || entry === '*')
|
|
73
46
|
return undefined;
|
|
@@ -144,10 +117,6 @@ export function projectAgentsForWire(defs, deps) {
|
|
|
144
117
|
const name = def.agentType;
|
|
145
118
|
if (typeof name !== 'string' || name.length === 0)
|
|
146
119
|
continue;
|
|
147
|
-
if (name.length > MAX_AGENT_NAME_CHARS) {
|
|
148
|
-
warnings.push(`agents wire: agent name "${name.slice(0, 40)}…" exceeds ${MAX_AGENT_NAME_CHARS} chars — definition skipped`);
|
|
149
|
-
continue;
|
|
150
|
-
}
|
|
151
120
|
if (seen.has(name))
|
|
152
121
|
continue;
|
|
153
122
|
seen.add(name);
|
|
@@ -161,29 +130,23 @@ export function projectAgentsForWire(defs, deps) {
|
|
|
161
130
|
warnings.push(`agents wire: agent "${name}" description truncated to ${MAX_AGENT_TEXT_CHARS} chars`);
|
|
162
131
|
}
|
|
163
132
|
}
|
|
164
|
-
const
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
const kept = list.filter(t => typeof t === 'string' && t.length > 0 && t.length <= MAX_AGENT_TOOL_NAME_CHARS);
|
|
168
|
-
if (kept.length !== list.length) {
|
|
133
|
+
const toolEntries = (list, label) => {
|
|
134
|
+
const entries = list.filter((t) => typeof t === 'string' && t.length > 0);
|
|
135
|
+
if (entries.length !== list.length)
|
|
169
136
|
warnings.push(`agents wire: agent "${name}" ${label} had invalid entries — dropped`);
|
|
170
|
-
|
|
171
|
-
if (kept.length === 0)
|
|
172
|
-
return undefined;
|
|
173
|
-
if (kept.length > MAX_AGENT_TOOLS) {
|
|
174
|
-
warnings.push(`agents wire: agent "${name}" ${label} truncated to ${MAX_AGENT_TOOLS} entries`);
|
|
175
|
-
return kept.slice(0, MAX_AGENT_TOOLS);
|
|
176
|
-
}
|
|
177
|
-
return kept;
|
|
137
|
+
return entries;
|
|
178
138
|
};
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
139
|
+
if (Array.isArray(def.tools))
|
|
140
|
+
item.allowTools = toolEntries(def.tools, 'tools');
|
|
141
|
+
if (Array.isArray(def.disallowedTools)) {
|
|
142
|
+
const denyTools = toolEntries(def.disallowedTools, 'disallowedTools');
|
|
143
|
+
if (denyTools.length > 0)
|
|
144
|
+
item.denyTools = denyTools;
|
|
145
|
+
}
|
|
146
|
+
let whoMemo;
|
|
147
|
+
const whoOf = () => {
|
|
148
|
+
if (whoMemo !== undefined)
|
|
149
|
+
return whoMemo;
|
|
187
150
|
let source;
|
|
188
151
|
try {
|
|
189
152
|
source = deps.agentSourceLabel?.(name);
|
|
@@ -191,25 +154,31 @@ export function projectAgentsForWire(defs, deps) {
|
|
|
191
154
|
catch {
|
|
192
155
|
source = undefined;
|
|
193
156
|
}
|
|
194
|
-
|
|
157
|
+
whoMemo = `agent "${name}"${typeof source === 'string' && source.length > 0 ? ` (${capForDisplay(source, 120)})` : ''}`;
|
|
158
|
+
return whoMemo;
|
|
159
|
+
};
|
|
160
|
+
const rosterInHand = typeof rosterMountedNames(deps.toolRoster) === 'object';
|
|
161
|
+
const flaws = agentToolListFlaws([item], deps.toolRoster).map((f) => {
|
|
162
|
+
if (!rosterInHand || f.list !== 'disallowedTools' || f.kind !== 'retired' || f.currentName === undefined || f.toolName !== undefined)
|
|
163
|
+
return f;
|
|
164
|
+
const to = f.currentName;
|
|
165
|
+
if (item.denyTools !== undefined)
|
|
166
|
+
item.denyTools = item.denyTools.map((e) => (e === f.entry ? to : e));
|
|
167
|
+
return { ...f, rewritten: true };
|
|
168
|
+
});
|
|
169
|
+
if (flaws.length > 0) {
|
|
170
|
+
const who = whoOf();
|
|
195
171
|
toolListFlaws.push(...flaws);
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
warnings.push(withhold
|
|
201
|
-
? `agents wire: ${who} is not sent to the engine — ${what}, and this engine refuses to start a run whose agent definitions name a tool that way. Fix the entry in the agent definition; until then this agent is not available.`
|
|
202
|
-
: `agents wire: ${who}: ${what} — tool names are matched exactly, so ${denyFlaws.length === 1 ? 'this entry hides' : 'these entries hide'} nothing from the agent, and newer engines refuse to start a run with it. Fix the entry in the agent definition.`);
|
|
172
|
+
for (const f of flaws) {
|
|
173
|
+
if (f.rewritten !== true)
|
|
174
|
+
continue;
|
|
175
|
+
warnings.push(`agents wire: ${who}: its disallowedTools entry ${toolListFlawPhrase(f)} — rewritten to ${JSON.stringify(f.currentName)} for this run (this run's tools include none named ${JSON.stringify(f.entry)}). Update the entry in the agent definition.`);
|
|
203
176
|
}
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
warnings.push(`agents wire: ${who}: its tools entry ${toolListFlawPhrase(f)} — tool names are matched exactly, so this entry does not give the agent that tool. Fix the entry in the agent definition.`);
|
|
209
|
-
}
|
|
177
|
+
for (const f of flaws) {
|
|
178
|
+
if (f.list !== 'tools')
|
|
179
|
+
continue;
|
|
180
|
+
warnings.push(`agents wire: ${who}: its tools entry ${toolListFlawPhrase(f)} — sent as written; tool names are matched exactly, so this entry gives the agent nothing unless this run has a tool with exactly that name. Fix the entry in the agent definition.`);
|
|
210
181
|
}
|
|
211
|
-
if (withhold)
|
|
212
|
-
continue;
|
|
213
182
|
}
|
|
214
183
|
if (def.memory !== undefined) {
|
|
215
184
|
if (typeof def.memory === 'string' && AGENT_MEMORY_WORDS.has(def.memory)) {
|
|
@@ -275,62 +244,58 @@ export function projectAgentsForWire(defs, deps) {
|
|
|
275
244
|
item.systemPrompt = prompt;
|
|
276
245
|
}
|
|
277
246
|
}
|
|
278
|
-
if (def.maxTurns !== undefined)
|
|
279
|
-
|
|
280
|
-
Number.isInteger(def.maxTurns) &&
|
|
281
|
-
def.maxTurns >= 1 &&
|
|
282
|
-
def.maxTurns <= MAX_AGENT_MAX_TURNS) {
|
|
283
|
-
item.maxTurns = def.maxTurns;
|
|
284
|
-
}
|
|
285
|
-
else {
|
|
286
|
-
warnings.push(`agents wire: agent "${name}" maxTurns ${String(def.maxTurns)} out of range (1..${MAX_AGENT_MAX_TURNS}) — dropped`);
|
|
287
|
-
}
|
|
288
|
-
}
|
|
247
|
+
if (def.maxTurns !== undefined)
|
|
248
|
+
item.maxTurns = def.maxTurns;
|
|
289
249
|
out.push(item);
|
|
290
250
|
}
|
|
291
251
|
return { agents: out.length > 0 ? out : undefined, warnings, ...(toolListFlaws.length > 0 ? { toolListFlaws } : {}) };
|
|
292
252
|
}
|
|
253
|
+
function taskAgentsVerdictOf(v) {
|
|
254
|
+
switch (v.kind) {
|
|
255
|
+
case 'value':
|
|
256
|
+
return v.value === true;
|
|
257
|
+
case 'unobserved':
|
|
258
|
+
case 'unreadable':
|
|
259
|
+
return undefined;
|
|
260
|
+
default:
|
|
261
|
+
return false;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
const TASK_AGENTS_CAPS_SETTLE_MS = 3000;
|
|
293
265
|
export async function engineSupportsTaskAgents(baseUrl, opts) {
|
|
266
|
+
const budget = opts?.timeoutMs ?? TASK_AGENTS_CAPS_SETTLE_MS;
|
|
294
267
|
if (opts?.client !== undefined) {
|
|
295
268
|
const injected = opts.client;
|
|
296
269
|
if (typeof injected?.capabilities !== 'function')
|
|
297
270
|
return undefined;
|
|
298
|
-
|
|
299
|
-
|
|
271
|
+
return taskAgentsVerdictOf(await engineCapValueVia(undefined, 'taskAgents', async () => {
|
|
272
|
+
const got = await settleWithinDeadline(budget, (signal) => injected.capabilities({ signal }));
|
|
273
|
+
if (got.kind !== 'value')
|
|
274
|
+
throw new Error('capabilities probe did not settle within its budget');
|
|
275
|
+
return got.value;
|
|
276
|
+
}));
|
|
300
277
|
}
|
|
301
278
|
const client = makeEngineWireClient({
|
|
302
279
|
baseUrl,
|
|
303
280
|
...(opts?.authToken ? { token: opts.authToken } : {}),
|
|
304
281
|
...(opts?.principal ? { principal: opts.principal } : {}),
|
|
305
|
-
timeoutMs:
|
|
282
|
+
timeoutMs: budget,
|
|
306
283
|
...(opts?.fetchImpl ? { fetchImpl: opts.fetchImpl } : {}),
|
|
307
284
|
});
|
|
308
285
|
if (!client)
|
|
309
286
|
return undefined;
|
|
310
|
-
|
|
311
|
-
const caps = await client.capabilities();
|
|
312
|
-
return taskAgentsOf(caps);
|
|
313
|
-
}
|
|
314
|
-
catch {
|
|
315
|
-
return undefined;
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
|
-
function taskAgentsOf(caps) {
|
|
319
|
-
if (caps === null || typeof caps !== 'object')
|
|
320
|
-
return false;
|
|
321
|
-
try {
|
|
322
|
-
return ownDataField(caps, 'taskAgents') === true;
|
|
323
|
-
}
|
|
324
|
-
catch {
|
|
325
|
-
return undefined;
|
|
326
|
-
}
|
|
287
|
+
return taskAgentsVerdictOf(await engineCapValueVia(undefined, 'taskAgents', () => client.capabilities()));
|
|
327
288
|
}
|
|
328
289
|
let activeProjector = null;
|
|
329
290
|
let preparedKey = null;
|
|
291
|
+
let preparedCapsGen = null;
|
|
330
292
|
let preparedPromise = null;
|
|
331
293
|
let payload;
|
|
332
|
-
let
|
|
333
|
-
|
|
294
|
+
let currentGeneration = null;
|
|
295
|
+
function concludeGeneration(generation, outcome) {
|
|
296
|
+
if (generation !== null && preparedPromise === generation && currentGeneration !== null)
|
|
297
|
+
currentGeneration.outcome = outcome;
|
|
298
|
+
}
|
|
334
299
|
const emittedWarnings = new Set();
|
|
335
300
|
function warnOnce(msg) {
|
|
336
301
|
if (emittedWarnings.has(msg))
|
|
@@ -338,45 +303,60 @@ function warnOnce(msg) {
|
|
|
338
303
|
emittedWarnings.add(msg);
|
|
339
304
|
console.error(`[sema] ${msg}`);
|
|
340
305
|
}
|
|
306
|
+
function capsVerdictAt(baseUrl) {
|
|
307
|
+
return baseUrl === null ? undefined : taskAgentsVerdictOf(engineCapValue(baseUrl, 'taskAgents'));
|
|
308
|
+
}
|
|
309
|
+
function capsSettledAt(baseUrl) {
|
|
310
|
+
return baseUrl === null ? Promise.resolve() : engineCapsSettled(baseUrl, { withinMs: TASK_AGENTS_CAPS_SETTLE_MS });
|
|
311
|
+
}
|
|
312
|
+
function kickTaskAgentsCaps(cfg) {
|
|
313
|
+
if (engineCapsLandingOf(cfg.baseUrl).kind !== 'not_landed')
|
|
314
|
+
return;
|
|
315
|
+
const client = makeEngineWireClient({
|
|
316
|
+
baseUrl: cfg.baseUrl,
|
|
317
|
+
...(cfg.authToken ? { token: cfg.authToken } : {}),
|
|
318
|
+
...(cfg.principal ? { principal: cfg.principal } : {}),
|
|
319
|
+
timeoutMs: TASK_AGENTS_CAPS_SETTLE_MS,
|
|
320
|
+
});
|
|
321
|
+
if (!client)
|
|
322
|
+
return;
|
|
323
|
+
kickEngineCapsProbe(cfg.baseUrl, () => client.capabilities());
|
|
324
|
+
}
|
|
325
|
+
function watchCapsVerdict(baseUrl) {
|
|
326
|
+
void engineCapsSettled(baseUrl).then(() => {
|
|
327
|
+
if (preparedKey !== baseUrl || capsVerdictAt(baseUrl) !== false)
|
|
328
|
+
return;
|
|
329
|
+
payload = undefined;
|
|
330
|
+
concludeGeneration(preparedPromise, 'ok');
|
|
331
|
+
currentGeneration?.settle();
|
|
332
|
+
});
|
|
333
|
+
}
|
|
341
334
|
function applyProjectionIfCurrent(generation, projected) {
|
|
342
335
|
if (generation === null || preparedPromise !== generation)
|
|
343
336
|
return false;
|
|
344
|
-
const accepted =
|
|
337
|
+
const accepted = capsVerdictAt(preparedKey) !== false;
|
|
345
338
|
if (accepted) {
|
|
346
339
|
for (const w of projected.warnings)
|
|
347
340
|
warnOnce(w);
|
|
348
341
|
payload = projected.agents;
|
|
349
342
|
}
|
|
350
|
-
|
|
343
|
+
else {
|
|
344
|
+
payload = undefined;
|
|
345
|
+
}
|
|
346
|
+
concludeGeneration(generation, 'ok');
|
|
347
|
+
currentGeneration?.settle();
|
|
351
348
|
return accepted;
|
|
352
349
|
}
|
|
353
|
-
function
|
|
354
|
-
const land = (verdict) => {
|
|
355
|
-
if (capsVerdict !== probe)
|
|
356
|
-
return verdict;
|
|
357
|
-
capsVerdict = verdict;
|
|
358
|
-
if (verdict === false) {
|
|
359
|
-
payload = undefined;
|
|
360
|
-
settleGeneration?.();
|
|
361
|
-
}
|
|
362
|
-
return verdict;
|
|
363
|
-
};
|
|
364
|
-
const probe = engineSupportsTaskAgents(cfg.baseUrl, {
|
|
365
|
-
authToken: cfg.authToken,
|
|
366
|
-
principal: cfg.principal,
|
|
367
|
-
}).then(land, () => land(undefined));
|
|
368
|
-
capsVerdict = probe;
|
|
369
|
-
return probe;
|
|
370
|
-
}
|
|
371
|
-
function capsSettled() {
|
|
372
|
-
return capsVerdict instanceof Promise ? capsVerdict : Promise.resolve();
|
|
373
|
-
}
|
|
374
|
-
async function runPrepare(cfg, projector, probe, generation) {
|
|
350
|
+
async function runPrepare(cfg, projector, generation) {
|
|
375
351
|
try {
|
|
376
|
-
const [
|
|
377
|
-
if (
|
|
378
|
-
if (
|
|
379
|
-
|
|
352
|
+
const [, projected] = await Promise.all([capsSettledAt(cfg.baseUrl), projector()]);
|
|
353
|
+
if (capsVerdictAt(cfg.baseUrl) === false) {
|
|
354
|
+
if (preparedKey === cfg.baseUrl) {
|
|
355
|
+
payload = undefined;
|
|
356
|
+
concludeGeneration(generation, 'ok');
|
|
357
|
+
if (projected.agents) {
|
|
358
|
+
warnOnce(`agents wire: this engine does not support per-task custom agents (capabilities.taskAgents is not true: the engine does not report it, or this deployment turns it off, for example a multi-tenant one; this client cannot tell which) — ${projected.agents.length} custom agent definition(s) will NOT be sent`);
|
|
359
|
+
}
|
|
380
360
|
}
|
|
381
361
|
return;
|
|
382
362
|
}
|
|
@@ -389,29 +369,33 @@ async function runPrepare(cfg, projector, probe, generation) {
|
|
|
389
369
|
catch (e) {
|
|
390
370
|
if (preparedPromise === generation)
|
|
391
371
|
payload = undefined;
|
|
372
|
+
concludeGeneration(generation, 'failed');
|
|
392
373
|
if (hostEnv().SEMA_DEBUG) {
|
|
393
|
-
console.error('[sema] agents wire prepare
|
|
374
|
+
console.error('[sema] agents wire prepare failed (the readiness gate refuses this turn):', e);
|
|
394
375
|
}
|
|
395
376
|
}
|
|
396
377
|
}
|
|
397
378
|
export function prepareTaskAgentsWireWith(cfg, projector) {
|
|
398
379
|
const key = cfg.baseUrl;
|
|
399
|
-
|
|
380
|
+
kickTaskAgentsCaps(cfg);
|
|
381
|
+
const capsGen = engineCapsGeneration(key);
|
|
382
|
+
if (preparedPromise && preparedKey === key && preparedCapsGen === capsGen)
|
|
400
383
|
return preparedPromise;
|
|
401
384
|
preparedKey = key;
|
|
385
|
+
preparedCapsGen = capsGen;
|
|
402
386
|
activeProjector = projector;
|
|
403
|
-
|
|
404
|
-
return startGeneration(generation => runPrepare(cfg, projector,
|
|
387
|
+
watchCapsVerdict(key);
|
|
388
|
+
return startGeneration(generation => runPrepare(cfg, projector, generation));
|
|
405
389
|
}
|
|
406
390
|
function startGeneration(run) {
|
|
407
391
|
let settle;
|
|
408
392
|
const generation = new Promise(resolve => {
|
|
409
393
|
settle = resolve;
|
|
410
394
|
});
|
|
411
|
-
const superseded =
|
|
395
|
+
const superseded = currentGeneration;
|
|
412
396
|
preparedPromise = generation;
|
|
413
|
-
|
|
414
|
-
superseded?.();
|
|
397
|
+
currentGeneration = { settle, outcome: undefined };
|
|
398
|
+
superseded?.settle();
|
|
415
399
|
void run(generation).then(settle, settle);
|
|
416
400
|
return generation;
|
|
417
401
|
}
|
|
@@ -423,28 +407,36 @@ export function invalidateTaskAgentsWire() {
|
|
|
423
407
|
return startGeneration(generation => runReproject(projector, generation));
|
|
424
408
|
}
|
|
425
409
|
async function runReproject(projector, generation) {
|
|
410
|
+
const base = preparedKey;
|
|
426
411
|
try {
|
|
427
412
|
let projected;
|
|
428
413
|
try {
|
|
429
414
|
projected = await projector();
|
|
430
415
|
}
|
|
431
416
|
catch (e) {
|
|
417
|
+
concludeGeneration(generation, 'failed');
|
|
432
418
|
if (hostEnv().SEMA_DEBUG) {
|
|
433
|
-
console.error('[sema] agents wire re-project
|
|
419
|
+
console.error('[sema] agents wire re-project failed (the readiness gate refuses until a projection succeeds):', e);
|
|
434
420
|
}
|
|
435
421
|
return;
|
|
436
422
|
}
|
|
437
|
-
await
|
|
423
|
+
await capsSettledAt(base);
|
|
438
424
|
applyProjectionIfCurrent(generation, projected);
|
|
439
425
|
}
|
|
440
426
|
catch {
|
|
427
|
+
concludeGeneration(generation, 'failed');
|
|
441
428
|
}
|
|
442
429
|
}
|
|
443
430
|
export async function awaitTaskAgentsWire(timeoutMs = 4000) {
|
|
444
431
|
if (!preparedPromise)
|
|
445
|
-
return;
|
|
446
|
-
if (
|
|
447
|
-
return;
|
|
432
|
+
return taskAgentsReady();
|
|
433
|
+
if (capsVerdictAt(preparedKey) === false)
|
|
434
|
+
return taskAgentsReady();
|
|
435
|
+
const projector = activeProjector;
|
|
436
|
+
if (currentGeneration?.outcome === 'failed' && projector !== null) {
|
|
437
|
+
payload = undefined;
|
|
438
|
+
void startGeneration(generation => runReproject(projector, generation));
|
|
439
|
+
}
|
|
448
440
|
let timeoutHandle;
|
|
449
441
|
let timedOut = false;
|
|
450
442
|
const deadline = new Promise(resolve => {
|
|
@@ -464,33 +456,56 @@ export async function awaitTaskAgentsWire(timeoutMs = 4000) {
|
|
|
464
456
|
if (timeoutHandle !== undefined)
|
|
465
457
|
clearTimeout(timeoutHandle);
|
|
466
458
|
}
|
|
459
|
+
if (preparedPromise === null || capsVerdictAt(preparedKey) === false)
|
|
460
|
+
return taskAgentsReady();
|
|
461
|
+
const outcome = currentGeneration?.outcome;
|
|
462
|
+
if (outcome === 'ok')
|
|
463
|
+
return taskAgentsReady();
|
|
464
|
+
if (outcome === 'failed')
|
|
465
|
+
return Object.freeze({ ok: false, refusal: assemblyRefusal('agents_projection_failed') });
|
|
466
|
+
kickTaskAgentsRefresh();
|
|
467
|
+
return Object.freeze({ ok: false, refusal: assemblyRefusal('agents_not_ready') });
|
|
468
|
+
}
|
|
469
|
+
function taskAgentsReady() {
|
|
470
|
+
return Object.freeze({ ok: true });
|
|
471
|
+
}
|
|
472
|
+
function kickTaskAgentsRefresh() {
|
|
473
|
+
const projector = activeProjector;
|
|
474
|
+
if (!preparedPromise || projector === null)
|
|
475
|
+
return false;
|
|
476
|
+
const generation = preparedPromise;
|
|
477
|
+
const base = preparedKey;
|
|
478
|
+
let refreshing;
|
|
479
|
+
try {
|
|
480
|
+
refreshing = projector();
|
|
481
|
+
}
|
|
482
|
+
catch {
|
|
483
|
+
return false;
|
|
484
|
+
}
|
|
485
|
+
void refreshing
|
|
486
|
+
.then(async (p) => {
|
|
487
|
+
await capsSettledAt(base);
|
|
488
|
+
applyProjectionIfCurrent(generation, p);
|
|
489
|
+
})
|
|
490
|
+
.catch(() => { });
|
|
491
|
+
return true;
|
|
467
492
|
}
|
|
468
493
|
export function taskAgentsField() {
|
|
469
|
-
const
|
|
470
|
-
if (
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
try {
|
|
474
|
-
refreshing = activeProjector();
|
|
475
|
-
}
|
|
476
|
-
catch {
|
|
477
|
-
return current ? { agents: current } : {};
|
|
478
|
-
}
|
|
479
|
-
void refreshing
|
|
480
|
-
.then(async (p) => {
|
|
481
|
-
await capsSettled();
|
|
482
|
-
applyProjectionIfCurrent(generation, p);
|
|
483
|
-
})
|
|
484
|
-
.catch(() => { });
|
|
494
|
+
const base = preparedKey;
|
|
495
|
+
if (capsVerdictAt(base) === false) {
|
|
496
|
+
payload = undefined;
|
|
497
|
+
return {};
|
|
485
498
|
}
|
|
499
|
+
const current = payload;
|
|
500
|
+
kickTaskAgentsRefresh();
|
|
486
501
|
return current ? { agents: current } : {};
|
|
487
502
|
}
|
|
488
503
|
export function _resetAgentsWireForTest() {
|
|
489
504
|
activeProjector = null;
|
|
490
505
|
preparedKey = null;
|
|
506
|
+
preparedCapsGen = null;
|
|
491
507
|
preparedPromise = null;
|
|
492
|
-
|
|
508
|
+
currentGeneration = null;
|
|
493
509
|
payload = undefined;
|
|
494
|
-
capsVerdict = undefined;
|
|
495
510
|
emittedWarnings.clear();
|
|
496
511
|
}
|
|
@@ -9,9 +9,5 @@ export type ApprovalDecidedByReading = {
|
|
|
9
9
|
value: true;
|
|
10
10
|
};
|
|
11
11
|
export declare function projectApprovalDecidedByCapability(caps: unknown): ApprovalDecidedByReading | undefined;
|
|
12
|
-
export declare function noteEngineCapsForApprovalDecidedBy(baseUrl: string, caps: unknown, opts?: {
|
|
13
|
-
generation?: number;
|
|
14
|
-
}): void;
|
|
15
12
|
export declare function observedApprovalDecidedBy(baseUrl?: string | undefined): ApprovalDecidedByReading;
|
|
16
13
|
export declare function approvalDecidedByAdmitted(reading: ApprovalDecidedByReading | undefined): boolean;
|
|
17
|
-
export declare function __resetApprovalDecidedByReadingsForTests(): void;
|
|
@@ -18,9 +18,6 @@ const reader = createEngineCapReader({
|
|
|
18
18
|
name: 'approvalDecidedBy',
|
|
19
19
|
project: projectApprovalDecidedByCapability,
|
|
20
20
|
});
|
|
21
|
-
export function noteEngineCapsForApprovalDecidedBy(baseUrl, caps, opts) {
|
|
22
|
-
reader.note(baseUrl, caps, opts);
|
|
23
|
-
}
|
|
24
21
|
export function observedApprovalDecidedBy(baseUrl = engineWireTarget()?.baseUrl) {
|
|
25
22
|
return reader.observed(baseUrl);
|
|
26
23
|
}
|
|
@@ -36,6 +33,3 @@ export function approvalDecidedByAdmitted(reading) {
|
|
|
36
33
|
return false;
|
|
37
34
|
}
|
|
38
35
|
}
|
|
39
|
-
export function __resetApprovalDecidedByReadingsForTests() {
|
|
40
|
-
reader.__resetForTests();
|
|
41
|
-
}
|
|
@@ -9,10 +9,6 @@ export type ApprovalsStreamLiveReading = {
|
|
|
9
9
|
live: boolean;
|
|
10
10
|
};
|
|
11
11
|
export declare function projectApprovalsStreamLiveCapability(caps: unknown): ApprovalsStreamLiveReading | undefined;
|
|
12
|
-
export declare function noteEngineCapsForApprovalsStreamLive(baseUrl: string, caps: unknown, opts?: {
|
|
13
|
-
generation?: number;
|
|
14
|
-
}): void;
|
|
15
12
|
export declare function observedApprovalsStreamLive(baseUrl?: string | undefined): ApprovalsStreamLiveReading;
|
|
16
13
|
export declare function livePendingNeedsReconcile(reading: ApprovalsStreamLiveReading): boolean;
|
|
17
14
|
export declare function approvalsStreamLiveDoctorDetail(reading: ApprovalsStreamLiveReading): string;
|
|
18
|
-
export declare function __resetApprovalsStreamLiveReadingsForTests(): void;
|
|
@@ -22,9 +22,6 @@ const reader = createEngineCapReader({
|
|
|
22
22
|
name: 'approvalsStreamLive',
|
|
23
23
|
project: projectApprovalsStreamLiveCapability,
|
|
24
24
|
});
|
|
25
|
-
export function noteEngineCapsForApprovalsStreamLive(baseUrl, caps, opts) {
|
|
26
|
-
reader.note(baseUrl, caps, opts);
|
|
27
|
-
}
|
|
28
25
|
export function observedApprovalsStreamLive(baseUrl = engineWireTarget()?.baseUrl) {
|
|
29
26
|
return reader.observed(baseUrl);
|
|
30
27
|
}
|
|
@@ -45,6 +42,3 @@ export function approvalsStreamLiveDoctorDetail(reading) {
|
|
|
45
42
|
: 'live approval push off on this deployment (no checkpoint store or tool approvals disabled; the engine reports one bit for both, so this client cannot tell which) — suspended asks are only visible through the reconcile cadence, so the client polls for them';
|
|
46
43
|
}
|
|
47
44
|
}
|
|
48
|
-
export function __resetApprovalsStreamLiveReadingsForTests() {
|
|
49
|
-
reader.__resetForTests();
|
|
50
|
-
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { AgentClient } from '@sema-agent/sdk';
|
|
2
|
+
export type AssistantInboxVerb = Pick<AgentClient['assistant'], 'inbox'>;
|
|
3
|
+
export interface AssistantInboxEntry {
|
|
4
|
+
readonly sessionId: string;
|
|
5
|
+
readonly scope?: string;
|
|
6
|
+
readonly gateKind?: string;
|
|
7
|
+
readonly severity?: 1 | 2 | 3 | 4 | 5;
|
|
8
|
+
readonly spentMicroUsd?: number;
|
|
9
|
+
readonly deadlineMs?: number;
|
|
10
|
+
readonly createdAtMs?: number;
|
|
11
|
+
readonly objective?: string;
|
|
12
|
+
readonly inputPreview?: string;
|
|
13
|
+
readonly requiresRealApproval?: true;
|
|
14
|
+
readonly mandated?: true;
|
|
15
|
+
readonly hasBidiControls?: true;
|
|
16
|
+
}
|
|
17
|
+
export type AssistantInboxUnavailableReason = 'unauthorized' | 'unreadable' | 'failed';
|
|
18
|
+
export type AssistantInboxReading = {
|
|
19
|
+
readonly kind: 'present';
|
|
20
|
+
readonly entries: readonly AssistantInboxEntry[];
|
|
21
|
+
readonly dropped: number;
|
|
22
|
+
} | {
|
|
23
|
+
readonly kind: 'unavailable';
|
|
24
|
+
readonly reason: AssistantInboxUnavailableReason;
|
|
25
|
+
readonly status?: number;
|
|
26
|
+
readonly errorCode?: string;
|
|
27
|
+
} | {
|
|
28
|
+
readonly kind: 'not-reported';
|
|
29
|
+
readonly via: 'lane-absent' | 'unarmed';
|
|
30
|
+
};
|
|
31
|
+
export declare function isAssistantLaneAbsent(err: {} | null | undefined): boolean;
|
|
32
|
+
export declare function readAssistantInbox(assistant: AssistantInboxVerb | null | undefined, opts?: {
|
|
33
|
+
readonly signal?: AbortSignal | undefined;
|
|
34
|
+
}): Promise<AssistantInboxReading>;
|