@sema-agent/client-core 0.83.5 → 0.84.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 +112 -0
- package/README.md +11 -11
- package/dist/adapt/wireShapes.js +3 -2
- package/dist/adapter/activeRunSelfHeal.js +7 -7
- package/dist/adapter/downstream/eventToSdkMessage.js +6 -2
- package/dist/adapter/downstream/wiringManifestView.d.ts +3 -1
- package/dist/adapter/downstream/wiringManifestView.js +1 -0
- package/dist/agentSession/engineAgentRegistryRead.d.ts +18 -0
- package/dist/agentSession/engineAgentRegistryRead.js +167 -0
- package/dist/agentsWireCaps.js +2 -1
- package/dist/attachmentsWireCaps.js +2 -2
- package/dist/controlRouter.js +1 -1
- package/dist/engineAgentAbsence.d.ts +37 -0
- package/dist/engineAgentAbsence.js +142 -0
- package/dist/engineErrorCodes.js +6 -5
- package/dist/engineNoticeCodes.d.ts +17 -0
- package/dist/engineNoticeCodes.js +45 -0
- package/dist/fleet/fleetProjection.js +3 -2
- package/dist/frozenSet.d.ts +1 -0
- package/dist/frozenSet.js +20 -0
- package/dist/handsSeam.d.ts +3 -0
- package/dist/handsSeam.js +19 -0
- package/dist/hitl/sessionPolicyDeliverable.d.ts +2 -1
- package/dist/hitl/sessionPolicyDeliverable.js +54 -4
- package/dist/index.d.ts +23 -13
- package/dist/index.js +12 -13
- package/dist/model/catalogLoader.js +3 -3
- package/dist/model/tierVocabulary.js +1 -1
- package/dist/request/taskRequest.js +15 -5
- package/dist/rewindWireCaps.d.ts +0 -1
- package/dist/seam.d.ts +2 -1
- package/dist/seatContract.js +2 -2
- package/dist/toolResult.js +2 -6
- package/dist/toolRoster.d.ts +16 -0
- package/dist/toolRoster.js +46 -5
- package/dist/wireErrorTriage.js +1 -11
- package/dist/workflowClient.js +4 -3
- package/dist/workflowMonitor.d.ts +1 -1
- package/docs/INTEGRATION-CLIENTS.md +364 -29
- package/package.json +3 -3
package/dist/wireErrorTriage.js
CHANGED
|
@@ -45,10 +45,6 @@ export function isPreStreamDrainingReject(err) {
|
|
|
45
45
|
const e = err;
|
|
46
46
|
return typeof e?.status === 'number' && e.status === 503 && e.errorCode === DRAINING_ERROR_CODE;
|
|
47
47
|
}
|
|
48
|
-
const RESUME_AT_TEXT_COMPAT = [
|
|
49
|
-
{ status: 404, marker: `(${RESUME_AT_ERROR_CODE_PREFIX}unknown_event)` },
|
|
50
|
-
{ status: 422, marker: `(${RESUME_AT_ERROR_CODE_PREFIX}no_session)` },
|
|
51
|
-
];
|
|
52
48
|
export function effectiveWireErrorCode(err) {
|
|
53
49
|
if (typeof err !== 'object' || err === null)
|
|
54
50
|
return undefined;
|
|
@@ -75,14 +71,8 @@ export function corruptStoredRowContent(where) {
|
|
|
75
71
|
return `The engine could not read a stored record this session needs in order to continue. The unreadable row is ${capForDisplay(where, 200)}; whoever operates this engine has to repair or remove that row before this session can continue.`;
|
|
76
72
|
}
|
|
77
73
|
export function isResumeAtRejection(err) {
|
|
78
|
-
const e = err;
|
|
79
74
|
const code = effectiveWireErrorCode(err);
|
|
80
|
-
|
|
81
|
-
return true;
|
|
82
|
-
const marker = RESUME_AT_TEXT_COMPAT.find((c) => c.status === e?.status)?.marker;
|
|
83
|
-
if (marker === undefined)
|
|
84
|
-
return false;
|
|
85
|
-
return [e?.message, e?.errorMessage].some((t) => typeof t === 'string' && t.endsWith(marker));
|
|
75
|
+
return code !== undefined && code.startsWith(RESUME_AT_ERROR_CODE_PREFIX);
|
|
86
76
|
}
|
|
87
77
|
export function drainingRetryDelayMs(err, attempt, opts) {
|
|
88
78
|
const ra = err?.retryAfterMs;
|
package/dist/workflowClient.js
CHANGED
|
@@ -240,7 +240,8 @@ function synthPhaseStatus(runStatus, agents) {
|
|
|
240
240
|
}
|
|
241
241
|
export function projectWorkflowRun(run) {
|
|
242
242
|
const parks = readWorkflowParks(run);
|
|
243
|
-
const
|
|
243
|
+
const agentsKnown = Array.isArray(run.agents);
|
|
244
|
+
const agents = (agentsKnown ? run.agents : []).map((r, i) => projectAgent(r, i));
|
|
244
245
|
const phases = projectPhases(run, agents);
|
|
245
246
|
const validTokens = (v) => typeof v === 'number' && Number.isInteger(v) && v >= 0 ? v : undefined;
|
|
246
247
|
const ownTokens = validTokens(run.stats?.tokens);
|
|
@@ -265,7 +266,7 @@ export function projectWorkflowRun(run) {
|
|
|
265
266
|
...(parks !== undefined ? { parks } : {}),
|
|
266
267
|
...(readWorkflowResumeAdmissionIncomplete(run) ? { resumeAdmissionIncomplete: true } : {}),
|
|
267
268
|
script: '',
|
|
268
|
-
agentCount: agents.length,
|
|
269
|
+
...(agentsKnown ? { agentCount: agents.length } : {}),
|
|
269
270
|
...(totalTokens !== undefined ? { totalTokens } : {}),
|
|
270
271
|
phases,
|
|
271
272
|
};
|
|
@@ -814,7 +815,7 @@ export function createLiveWorkflowSource(config) {
|
|
|
814
815
|
code = null;
|
|
815
816
|
lastError = null;
|
|
816
817
|
if (engineWireDebugEnabled()) {
|
|
817
|
-
hostLog('debug', `[sema][workflow][perf] get ${Date.now() - t0}ms first=${first} agents=${current.agentCount} phases=${current.phases.length}`);
|
|
818
|
+
hostLog('debug', `[sema][workflow][perf] get ${Date.now() - t0}ms first=${first} agents=${current.agentCount ?? '?'} phases=${current.phases.length}`);
|
|
818
819
|
}
|
|
819
820
|
first = false;
|
|
820
821
|
notify();
|
|
@@ -49,7 +49,7 @@ export interface WorkflowRunState {
|
|
|
49
49
|
scriptPath?: string;
|
|
50
50
|
status: 'running' | 'done' | 'failed' | 'stopped' | 'paused' | 'parked' | 'unknown';
|
|
51
51
|
cloud?: boolean;
|
|
52
|
-
agentCount
|
|
52
|
+
agentCount?: number;
|
|
53
53
|
totalTokens?: number;
|
|
54
54
|
phases: WorkflowPhase[];
|
|
55
55
|
parks?: readonly WorkflowParkRowView[];
|