@sema-agent/client-core 0.103.0 → 0.104.1
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 +85 -0
- package/README.md +18 -14
- package/dist/adapter/downstream/eventToSdkMessage.js +2 -0
- package/dist/adapter/downstream/terminalToSdkResult.d.ts +0 -1
- package/dist/adapter/downstream/terminalToSdkResult.js +3 -1
- package/dist/agentSession/engineAgentRegistryRead.js +3 -0
- package/dist/coreValuePorts.d.ts +3 -1
- package/dist/coreValuePorts.js +5 -0
- package/dist/deviceRebind.d.ts +17 -4
- package/dist/deviceRebind.js +43 -14
- package/dist/engineAgentAbsence.d.ts +1 -0
- package/dist/executionPlacementWords.d.ts +3 -0
- package/dist/executionPlacementWords.js +2 -0
- package/dist/generated/engineFactTables.d.ts +3 -2
- package/dist/generated/engineFactTables.js +17 -1
- package/dist/generated/engineNoticeTables.js +12 -0
- package/dist/hitl/automaticAnswerVerdict.js +47 -11
- package/dist/hitl/livePendingAsk.d.ts +2 -1
- package/dist/hitl/livePendingAsk.js +7 -1
- package/dist/hitl/sessionPolicyDeliverable.js +31 -5
- package/dist/hitl/toolApprovalWire.d.ts +5 -4
- package/dist/hitl/toolApprovalWire.js +215 -47
- package/dist/host.d.ts +0 -3
- package/dist/hostTurnSettings.js +3 -1
- package/dist/humanTurn.js +2 -2
- package/dist/index.d.ts +5 -2
- package/dist/index.js +1 -0
- package/dist/jsonFaithful.js +5 -3
- package/dist/mcpLiveness.d.ts +1 -1
- package/dist/mcpWireCaps.js +1 -1
- package/dist/printModelStatus.d.ts +1 -0
- package/dist/printModelStatus.js +6 -2
- package/dist/retryStatus.d.ts +8 -1
- package/dist/retryStatus.js +13 -4
- package/dist/ruleCompileVerdict.d.ts +1 -0
- package/dist/ruleCompileVerdict.js +3 -1
- package/dist/seatContract.d.ts +7 -7
- package/dist/seatContract.js +39 -10
- package/dist/sessionRowTag.d.ts +24 -0
- package/dist/sessionRowTag.js +77 -0
- package/dist/steering.d.ts +1 -0
- package/dist/steering.js +34 -26
- package/dist/systemReminderTag.js +14 -4
- package/docs/INTEGRATION-CLIENTS.md +346 -11
- package/package.json +5 -5
package/dist/steering.js
CHANGED
|
@@ -25,37 +25,45 @@ const PHRASE_TO_STATUS = [
|
|
|
25
25
|
['failed', 'failed'],
|
|
26
26
|
['killed', 'killed'],
|
|
27
27
|
];
|
|
28
|
+
const BACKGROUND_TASK_LINE = new RegExp('^- \\[([^\\]]+)\\] Task "([\\s\\S]*)" (' +
|
|
29
|
+
PHRASE_TO_STATUS.map(([phrase]) => phrase.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')).join('|') +
|
|
30
|
+
')(?: — ((?:(?!" )[\\s\\S])*))?$');
|
|
28
31
|
function parseBackgroundTaskLine(line) {
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
32
|
+
const m = BACKGROUND_TASK_LINE.exec(line.trim());
|
|
33
|
+
if (!m)
|
|
34
|
+
return null;
|
|
35
|
+
const taskId = m[1];
|
|
36
|
+
const description = m[2];
|
|
37
|
+
const status = PHRASE_TO_STATUS.find(([phrase]) => phrase === m[3])?.[1];
|
|
38
|
+
if (taskId === undefined || description === undefined || status === undefined)
|
|
39
|
+
return null;
|
|
40
|
+
const read = m[4];
|
|
41
|
+
return {
|
|
42
|
+
type: 'task_status',
|
|
43
|
+
taskId,
|
|
44
|
+
taskType: 'local_bash',
|
|
45
|
+
status,
|
|
46
|
+
description,
|
|
47
|
+
deltaSummary: null,
|
|
48
|
+
...(read !== undefined ? { read } : {}),
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
function rowBoundariesTrusted(lines) {
|
|
52
|
+
let last = lines.length - 1;
|
|
53
|
+
while (last >= 0 && (lines[last] ?? '').trim() === '')
|
|
54
|
+
last--;
|
|
55
|
+
for (let i = 0; i < last; i++) {
|
|
56
|
+
if (/^- \[[^\]]+\] Task "[^"]*$/.test((lines[i] ?? '').trim()))
|
|
57
|
+
return false;
|
|
50
58
|
}
|
|
51
|
-
return
|
|
59
|
+
return true;
|
|
52
60
|
}
|
|
53
61
|
export function steeringInjectedToAttachments(source, preview) {
|
|
54
62
|
if (source === 'background_tasks') {
|
|
55
|
-
const
|
|
56
|
-
|
|
57
|
-
.map(parseBackgroundTaskLine)
|
|
58
|
-
|
|
63
|
+
const lines = preview.split('\n');
|
|
64
|
+
const tasks = rowBoundariesTrusted(lines)
|
|
65
|
+
? lines.map(parseBackgroundTaskLine).filter((t) => t !== null)
|
|
66
|
+
: [];
|
|
59
67
|
if (tasks.length > 0)
|
|
60
68
|
return tasks;
|
|
61
69
|
}
|
|
@@ -39,11 +39,21 @@ export function stripSystemReminderBlocks(text) {
|
|
|
39
39
|
}
|
|
40
40
|
return pos === 0 ? text : out + text.slice(pos);
|
|
41
41
|
}
|
|
42
|
-
const
|
|
43
|
-
const
|
|
42
|
+
const ENGINE_DEFUSAL_ENTITY = /&(lt|gt);/g;
|
|
43
|
+
const ENVELOPE_TAG_TOKEN = /<[^A-Za-z0-9>]{0,12}(?:system-reminder|task-notification)(?:[^>]{0,200}>)?/gi;
|
|
44
|
+
const CUT_TAG_HEAD = /<[^A-Za-z0-9>]{0,12}([A-Za-z-]{1,16})…/g;
|
|
45
|
+
const ENVELOPE_TAG_HEAD_BRACKET = /<(?=[^A-Za-z0-9>]{0,12}(?:system-reminder|task-notification|([A-Za-z-]{1,16})…))/gi;
|
|
46
|
+
const ENVELOPE_TAG_NAMES = Object.freeze(['system-reminder', 'task-notification']);
|
|
47
|
+
function isCutTagName(head) {
|
|
48
|
+
if (head === undefined || head === '')
|
|
49
|
+
return false;
|
|
50
|
+
const h = head.toLowerCase();
|
|
51
|
+
return ENVELOPE_TAG_NAMES.some((name) => name.length > h.length && name.startsWith(h));
|
|
52
|
+
}
|
|
44
53
|
export function stripSystemReminderTagTokens(text) {
|
|
45
54
|
if (typeof text !== 'string')
|
|
46
55
|
return text;
|
|
47
|
-
const
|
|
48
|
-
|
|
56
|
+
const restored = text.replace(ENGINE_DEFUSAL_ENTITY, (_entity, name) => (name === 'lt' ? '<' : '>'));
|
|
57
|
+
const once = restored.replace(ENVELOPE_TAG_TOKEN, ' ').replace(CUT_TAG_HEAD, (head, name) => (isCutTagName(name) ? ' …' : head));
|
|
58
|
+
return once.replace(ENVELOPE_TAG_HEAD_BRACKET, (bracket, cutName) => (cutName === undefined || isCutTagName(cutName) ? ' ' : bracket));
|
|
49
59
|
}
|