@sema-agent/client-core 0.101.0 → 0.103.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 +153 -0
- package/README.md +19 -11
- package/dist/adapt/toolCards.d.ts +4 -2
- package/dist/adapt/toolCards.js +22 -6
- package/dist/adapt.d.ts +1 -1
- package/dist/adapt.js +1 -1
- package/dist/adapter/downstream/eventToSdkMessage.d.ts +5 -1
- package/dist/adapter/downstream/eventToSdkMessage.js +26 -70
- package/dist/adapter/downstream/terminalToSdkResult.js +0 -1
- package/dist/adapter/downstream/wiringManifestView.d.ts +1 -0
- package/dist/adapter/downstream/wiringManifestView.js +141 -0
- package/dist/cloudConfigWireCaps.js +6 -3
- package/dist/compensations.js +1 -1
- package/dist/credentialPlaneCapability.d.ts +22 -0
- package/dist/credentialPlaneCapability.js +75 -0
- package/dist/deviceExecutorManagementCapability.d.ts +1 -0
- package/dist/deviceExecutorManagementCapability.js +3 -1
- package/dist/displayUntrusted.d.ts +8 -4
- package/dist/displayUntrusted.js +769 -96
- package/dist/engineErrorCodes.d.ts +1 -0
- package/dist/engineErrorCodes.js +3 -1
- package/dist/engineNoticeCodes.d.ts +26 -0
- package/dist/engineNoticeCodes.js +121 -12
- package/dist/engineRowRef.js +2 -0
- package/dist/errorSupplementRoles.js +1 -3
- package/dist/eventLeg.js +2 -1
- package/dist/fleet/fleetProjection.js +16 -10
- package/dist/gateOutcome.d.ts +20 -0
- package/dist/gateOutcome.js +89 -0
- package/dist/generated/engineAskFaceTables.js +2 -2
- package/dist/generated/engineFactTables.d.ts +6 -2
- package/dist/generated/engineFactTables.js +41 -1
- package/dist/generated/engineNoticeTables.js +18 -0
- package/dist/generated/settingsSchemaDefaultModel.d.ts +1 -1
- package/dist/generated/settingsSchemaDefaultModel.js +2 -2
- package/dist/generated/settingsSchemaFns.d.ts +15 -0
- package/dist/generated/settingsSchemaFns.js +25 -2
- package/dist/generated/settingsSchemaHooksClassifier.js +109 -29
- package/dist/generated/settingsSchemaMcpRequestEntry.d.ts +1 -1
- package/dist/generated/settingsSchemaMcpRequestEntry.js +213 -93
- package/dist/generated/settingsSchemaMcpServerName.d.ts +1 -0
- package/dist/generated/settingsSchemaMcpServerName.js +8 -0
- package/dist/generated/settingsSchemaOwnKeyRead.d.ts +1 -0
- package/dist/generated/settingsSchemaOwnKeyRead.js +172 -0
- package/dist/generated/settingsSchemaPlainJsonObject.d.ts +1 -0
- package/dist/generated/settingsSchemaPlainJsonObject.js +28 -0
- package/dist/generated/settingsSchemaSafetyMergeSpec.js +10 -7
- package/dist/generated/settingsSchemaTierWords.d.ts +1 -0
- package/dist/generated/settingsSchemaTierWords.js +7 -0
- package/dist/generated/settingsSchemaTypes.d.ts +3 -1
- package/dist/hitl/automaticAnswerVerdict.d.ts +1 -1
- package/dist/hitl/decisionConflict.js +11 -11
- package/dist/hitl/decisionRefusal.d.ts +1 -0
- package/dist/hitl/decisionRefusal.js +4 -2
- package/dist/hitl/editedRuleTextPrecheck.d.ts +1 -0
- package/dist/hitl/editedRuleTextPrecheck.js +26 -1
- package/dist/hitl/persistedRulesWire.js +1 -0
- package/dist/hitl/planReviewWire.d.ts +2 -1
- package/dist/hitl/planReviewWire.js +8 -12
- package/dist/hitl/sessionPolicyDeliverable.d.ts +0 -1
- package/dist/hitl/sessionPolicyDeliverable.js +0 -5
- package/dist/hitl/sessionPolicyWire.js +1 -1
- package/dist/hitl/toolApprovalWire.d.ts +18 -6
- package/dist/hitl/toolApprovalWire.js +9 -4
- package/dist/i18n/messages.en.d.ts +43 -0
- package/dist/i18n/messages.en.js +44 -1
- package/dist/i18n/messages.zh.js +46 -1
- package/dist/index.d.ts +11 -2
- package/dist/index.js +7 -1
- package/dist/inheritEnvWire.d.ts +1 -0
- package/dist/inheritEnvWire.js +8 -5
- package/dist/interactiveHalt.d.ts +3 -1
- package/dist/interactiveHalt.js +2 -0
- package/dist/interactiveInterrupt.d.ts +2 -0
- package/dist/interactiveInterrupt.js +15 -0
- package/dist/mcpEngineLeg.d.ts +3 -0
- package/dist/mcpEngineLeg.js +4 -1
- package/dist/mcpLiveness.d.ts +18 -0
- package/dist/mcpLiveness.js +48 -1
- package/dist/mcpReconnect.d.ts +3 -0
- package/dist/mcpReconnect.js +6 -0
- package/dist/mcpStatusSupersetKeys.js +24 -1
- package/dist/mcpWireCaps.d.ts +2 -3
- package/dist/mcpWireCaps.js +9 -8
- package/dist/memoryEntriesWire.d.ts +35 -1
- package/dist/memoryEntriesWire.js +110 -14
- package/dist/modsFace.d.ts +8 -0
- package/dist/modsFace.js +63 -0
- package/dist/ownKey.d.ts +1 -0
- package/dist/ownKey.js +15 -0
- package/dist/postureKnob.js +1 -1
- package/dist/prepareRefusal.d.ts +0 -1
- package/dist/prepareRefusal.js +0 -3
- package/dist/printToolResultFrame.js +1 -1
- package/dist/promptProfileWireCaps.d.ts +1 -3
- package/dist/promptProfileWireCaps.js +2 -2
- package/dist/request/printNotification.js +1 -1
- package/dist/request/taskRequest.d.ts +22 -1
- package/dist/request/taskRequest.js +126 -10
- package/dist/retryStatus.d.ts +13 -1
- package/dist/retryStatus.js +20 -5
- package/dist/seam.js +1 -1
- package/dist/seatContract.d.ts +22 -6
- package/dist/seatContract.js +45 -6
- package/dist/sessionBackground.d.ts +165 -0
- package/dist/sessionBackground.js +781 -0
- package/dist/sessionBackgroundHandoff.d.ts +54 -0
- package/dist/sessionBackgroundHandoff.js +321 -0
- package/dist/sessionMap.js +4 -1
- package/dist/sessionMemoryErase.js +24 -2
- package/dist/settingsCredentialKeyPaths.js +2 -17
- package/dist/thinkingLatch.d.ts +69 -0
- package/dist/thinkingLatch.js +255 -0
- package/dist/thinkingLatchWords.d.ts +7 -0
- package/dist/thinkingLatchWords.js +4 -0
- package/dist/toolResult.js +2 -24
- package/dist/turnFailurePresentation.js +8 -1
- package/dist/wireFailureShape.d.ts +12 -1
- package/dist/wireFailureShape.js +58 -24
- package/dist/wireRefusalCopy.d.ts +0 -3
- package/dist/wireRefusalCopy.js +0 -17
- package/docs/INTEGRATION-CLIENTS.md +458 -14
- package/package.json +5 -5
- package/dist/argvFlagValue.d.ts +0 -8
- package/dist/argvFlagValue.js +0 -37
|
@@ -38,10 +38,17 @@ export declare function scopeExternalOriginVerdict(reading: MemoryExportReading,
|
|
|
38
38
|
originAware: boolean;
|
|
39
39
|
}): ScopeExternalOriginVerdict;
|
|
40
40
|
export type { MemoryErasedBinding };
|
|
41
|
+
export type MemoryErasedBindingReading = Exclude<MemoryErasedBinding, {
|
|
42
|
+
state: 'bound';
|
|
43
|
+
}> | (Omit<Extract<MemoryErasedBinding, {
|
|
44
|
+
state: 'bound';
|
|
45
|
+
}>, 'slug'> & {
|
|
46
|
+
slug?: string;
|
|
47
|
+
});
|
|
41
48
|
export interface MemoryErasedRow {
|
|
42
49
|
id: string;
|
|
43
50
|
rev: string;
|
|
44
|
-
binding:
|
|
51
|
+
binding: MemoryErasedBindingReading | null;
|
|
45
52
|
}
|
|
46
53
|
export interface MemoryEraseNotFoundRow {
|
|
47
54
|
id: string;
|
|
@@ -54,6 +61,31 @@ export interface MemoryEraseConflictRow {
|
|
|
54
61
|
id: string;
|
|
55
62
|
reason: string;
|
|
56
63
|
}
|
|
64
|
+
declare const MEMORY_ERASE_CARRIER_CLASSES: readonly ["projection", "shadow", "indexLine", "quarantineCopy", "planArchive", "planWorkbook", "evidenceBinding", "backendDerived"];
|
|
65
|
+
export type MemoryEraseCarrierClass = (typeof MEMORY_ERASE_CARRIER_CLASSES)[number];
|
|
66
|
+
export type MemoryEraseCarrierReading = {
|
|
67
|
+
removed: number;
|
|
68
|
+
remaining: number;
|
|
69
|
+
} | {
|
|
70
|
+
unverified: true;
|
|
71
|
+
};
|
|
72
|
+
declare const ERASE_REPLAY_OF_LANE: Readonly<{
|
|
73
|
+
readonly journal: "converges";
|
|
74
|
+
readonly none: "unsupported";
|
|
75
|
+
}>;
|
|
76
|
+
export interface MemoryEraseResidualsReading {
|
|
77
|
+
carriers: Record<MemoryEraseCarrierClass, MemoryEraseCarrierReading>;
|
|
78
|
+
replay: (typeof ERASE_REPLAY_OF_LANE)[keyof typeof ERASE_REPLAY_OF_LANE];
|
|
79
|
+
propagation: 'local-store-only';
|
|
80
|
+
}
|
|
81
|
+
export type MemoryErasePartialCause = {
|
|
82
|
+
kind: 'entries_pending';
|
|
83
|
+
} | {
|
|
84
|
+
kind: 'carriers_residual';
|
|
85
|
+
carriers: MemoryEraseCarrierClass[];
|
|
86
|
+
} | {
|
|
87
|
+
kind: 'unknown';
|
|
88
|
+
};
|
|
57
89
|
export type MemoryEraseUnreadableCause = 'body_unreadable' | 'envelope_absent' | 'version_absent' | 'unsupported_version' | 'envelope_unreadable' | 'too_many_rows' | 'erased_rows_unreadable' | 'not_found_rows_unreadable' | 'conflict_rows_unreadable' | 'erased_previously_rows_unreadable';
|
|
58
90
|
export type MemoryEraseReceiptReading = {
|
|
59
91
|
kind: 'malformed';
|
|
@@ -73,6 +105,8 @@ export type MemoryEraseReceiptReading = {
|
|
|
73
105
|
erasedPreviouslyDropped: number;
|
|
74
106
|
conflicts: MemoryEraseConflictRow[];
|
|
75
107
|
conflictsDropped: number;
|
|
108
|
+
residuals: MemoryEraseResidualsReading | null;
|
|
109
|
+
partialCause: MemoryErasePartialCause | null;
|
|
76
110
|
};
|
|
77
111
|
export declare function readMemoryEraseReceipt(body: unknown): MemoryEraseReceiptReading;
|
|
78
112
|
export type MemoryEraseCounts = {
|
|
@@ -38,12 +38,6 @@ function snapshotArray(v) {
|
|
|
38
38
|
}
|
|
39
39
|
return { items, unreadable, tooLarge: false };
|
|
40
40
|
}
|
|
41
|
-
function arrayLengthOrNull(v) {
|
|
42
|
-
const snap = snapshotArray(v);
|
|
43
|
-
if (snap === null || snap.tooLarge)
|
|
44
|
-
return null;
|
|
45
|
-
return snap.items.length + snap.unreadable;
|
|
46
|
-
}
|
|
47
41
|
function originMarkOf(row) {
|
|
48
42
|
if (ownPresent(row, 'origin'))
|
|
49
43
|
return 'marked';
|
|
@@ -175,7 +169,24 @@ export function scopeExternalOriginVerdict(reading, asked) {
|
|
|
175
169
|
}
|
|
176
170
|
return { kind: 'none_in_this_scope', scope: reading.scope };
|
|
177
171
|
}
|
|
178
|
-
const
|
|
172
|
+
const MEMORY_ERASE_CARRIER_CLASSES = Object.freeze([
|
|
173
|
+
'projection',
|
|
174
|
+
'shadow',
|
|
175
|
+
'indexLine',
|
|
176
|
+
'quarantineCopy',
|
|
177
|
+
'planArchive',
|
|
178
|
+
'planWorkbook',
|
|
179
|
+
'evidenceBinding',
|
|
180
|
+
'backendDerived',
|
|
181
|
+
]);
|
|
182
|
+
const MEMORY_ERASE_CARRIER_CLASS_SET = new Set(MEMORY_ERASE_CARRIER_CLASSES);
|
|
183
|
+
const ERASE_REPLAY_OF_LANE = Object.freeze({ journal: 'converges', none: 'unsupported' });
|
|
184
|
+
const _eraseResidualsPin = true;
|
|
185
|
+
void _eraseResidualsPin;
|
|
186
|
+
const ERASE_RECEIPT_VERSIONS = new Map([
|
|
187
|
+
[1, Object.freeze({ boundSlug: 'required', carrierTable: false })],
|
|
188
|
+
[2, Object.freeze({ boundSlug: 'optional', carrierTable: true })],
|
|
189
|
+
]);
|
|
179
190
|
function eraseStatusOf(v) {
|
|
180
191
|
return v === 'complete' || v === 'partial' ? v : null;
|
|
181
192
|
}
|
|
@@ -185,7 +196,7 @@ function eraseEvidenceCapabilityOf(v) {
|
|
|
185
196
|
function eraseCustodyStateOf(v) {
|
|
186
197
|
return v === 'complete' || v === 'damaged' || v === 'capability-absent' ? v : null;
|
|
187
198
|
}
|
|
188
|
-
function erasedBindingOf(v) {
|
|
199
|
+
function erasedBindingOf(v, slugRule) {
|
|
189
200
|
if (!plainObject(v))
|
|
190
201
|
return null;
|
|
191
202
|
const state = v.state;
|
|
@@ -194,10 +205,75 @@ function erasedBindingOf(v) {
|
|
|
194
205
|
if (state !== 'bound')
|
|
195
206
|
return null;
|
|
196
207
|
const scope = v.scope;
|
|
208
|
+
if (!nonEmptyString(scope))
|
|
209
|
+
return null;
|
|
210
|
+
const slugPresent = Object.hasOwn(v, 'slug');
|
|
211
|
+
if (!slugPresent)
|
|
212
|
+
return slugRule === 'optional' ? { state: 'bound', scope } : null;
|
|
197
213
|
const slug = v.slug;
|
|
198
|
-
|
|
214
|
+
return nonEmptyString(slug) ? { state: 'bound', scope, slug } : null;
|
|
215
|
+
}
|
|
216
|
+
function carrierAnswerOf(v) {
|
|
217
|
+
if (!plainObject(v))
|
|
218
|
+
return null;
|
|
219
|
+
const unverified = readThrownSlot(v, 'unverified', 'data');
|
|
220
|
+
const removed = readThrownSlot(v, 'removed', 'data');
|
|
221
|
+
const remaining = readThrownSlot(v, 'remaining', 'data');
|
|
222
|
+
if (unverified !== undefined)
|
|
223
|
+
return unverified === true && removed === undefined && remaining === undefined ? { unverified: true } : null;
|
|
224
|
+
return nonNegativeInt(removed) && nonNegativeInt(remaining) ? { removed, remaining } : null;
|
|
225
|
+
}
|
|
226
|
+
function eraseResidualsOf(o, lane) {
|
|
227
|
+
try {
|
|
228
|
+
const raw = readThrownSlot(o, 'residuals', 'data');
|
|
229
|
+
if (!plainObject(raw))
|
|
230
|
+
return null;
|
|
231
|
+
const rawCarriers = readThrownSlot(raw, 'carriers', 'data');
|
|
232
|
+
const replay = readThrownSlot(raw, 'replay', 'data');
|
|
233
|
+
const propagation = readThrownSlot(raw, 'propagation', 'data');
|
|
234
|
+
if (!plainObject(rawCarriers) || replay !== ERASE_REPLAY_OF_LANE[lane] || propagation !== 'local-store-only')
|
|
235
|
+
return null;
|
|
236
|
+
if (Reflect.ownKeys(rawCarriers).some((k) => typeof k !== 'string' || !MEMORY_ERASE_CARRIER_CLASS_SET.has(k)))
|
|
237
|
+
return null;
|
|
238
|
+
const carriers = {};
|
|
239
|
+
for (const cls of MEMORY_ERASE_CARRIER_CLASSES) {
|
|
240
|
+
const answer = carrierAnswerOf(readThrownSlot(rawCarriers, cls, 'data'));
|
|
241
|
+
if (answer === null)
|
|
242
|
+
return null;
|
|
243
|
+
carriers[cls] = answer;
|
|
244
|
+
}
|
|
245
|
+
return { carriers, replay: ERASE_REPLAY_OF_LANE[lane], propagation };
|
|
246
|
+
}
|
|
247
|
+
catch {
|
|
199
248
|
return null;
|
|
200
|
-
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
function erasePartialCauseOf(f) {
|
|
252
|
+
if (f.status === 'complete')
|
|
253
|
+
return null;
|
|
254
|
+
if (f.conflicts.length > 0)
|
|
255
|
+
return { kind: 'entries_pending' };
|
|
256
|
+
if (f.dropped > 0 || f.pinnedIds === null)
|
|
257
|
+
return { kind: 'unknown' };
|
|
258
|
+
const claimed = new Set([...f.erased.map((r) => r.id), ...(f.erasedPreviously ?? []).map((r) => r.id)]);
|
|
259
|
+
const notFound = new Set(f.notFound.map((r) => r.id));
|
|
260
|
+
let historyUnknown = false;
|
|
261
|
+
for (const id of f.pinnedIds) {
|
|
262
|
+
if (claimed.has(id))
|
|
263
|
+
continue;
|
|
264
|
+
if (!notFound.has(id))
|
|
265
|
+
return { kind: 'entries_pending' };
|
|
266
|
+
if (f.custodyState !== 'complete')
|
|
267
|
+
historyUnknown = true;
|
|
268
|
+
}
|
|
269
|
+
if (historyUnknown || f.residuals === null)
|
|
270
|
+
return { kind: 'unknown' };
|
|
271
|
+
const carriers = f.residuals.carriers;
|
|
272
|
+
const residual = MEMORY_ERASE_CARRIER_CLASSES.filter((c) => {
|
|
273
|
+
const a = carriers[c];
|
|
274
|
+
return 'unverified' in a || a.remaining > 0;
|
|
275
|
+
});
|
|
276
|
+
return residual.length > 0 ? { kind: 'carriers_residual', carriers: residual } : { kind: 'unknown' };
|
|
201
277
|
}
|
|
202
278
|
export function readMemoryEraseReceipt(body) {
|
|
203
279
|
let o;
|
|
@@ -229,8 +305,10 @@ export function readMemoryEraseReceipt(body) {
|
|
|
229
305
|
return { kind: 'malformed', why: 'envelope_absent' };
|
|
230
306
|
if (rawV === undefined)
|
|
231
307
|
return { kind: 'malformed', why: 'version_absent' };
|
|
232
|
-
|
|
308
|
+
const rule = ERASE_RECEIPT_VERSIONS.get(rawV);
|
|
309
|
+
if (rule === undefined)
|
|
233
310
|
return { kind: 'malformed', why: 'unsupported_version' };
|
|
311
|
+
const slugRule = rule.boundSlug;
|
|
234
312
|
const status = eraseStatusOf(rawStatus);
|
|
235
313
|
const evidenceCapability = eraseEvidenceCapabilityOf(rawEvidence);
|
|
236
314
|
const custodyState = eraseCustodyStateOf(rawCustody);
|
|
@@ -241,13 +319,13 @@ export function readMemoryEraseReceipt(body) {
|
|
|
241
319
|
let notFoundSnap;
|
|
242
320
|
let conflictsSnap;
|
|
243
321
|
let previouslySnap;
|
|
244
|
-
let
|
|
322
|
+
let selectedSnap;
|
|
245
323
|
try {
|
|
246
324
|
erasedSnap = snapshotArray(rawErased);
|
|
247
325
|
notFoundSnap = snapshotArray(rawNotFound);
|
|
248
326
|
conflictsSnap = snapshotArray(rawConflicts);
|
|
249
327
|
previouslySnap = rawPreviously === undefined ? null : snapshotArray(rawPreviously);
|
|
250
|
-
|
|
328
|
+
selectedSnap = snapshotArray(rawSelected);
|
|
251
329
|
}
|
|
252
330
|
catch {
|
|
253
331
|
return { kind: 'malformed', why: 'body_unreadable' };
|
|
@@ -255,6 +333,10 @@ export function readMemoryEraseReceipt(body) {
|
|
|
255
333
|
if (erasedSnap === null || notFoundSnap === null || conflictsSnap === null) {
|
|
256
334
|
return { kind: 'malformed', why: 'envelope_unreadable' };
|
|
257
335
|
}
|
|
336
|
+
const selectedIds = selectedSnap === null || selectedSnap.tooLarge ? null : selectedSnap.items.length + selectedSnap.unreadable;
|
|
337
|
+
const pinnedIds = selectedSnap !== null && !selectedSnap.tooLarge && selectedSnap.unreadable === 0 && selectedSnap.items.every(nonEmptyString)
|
|
338
|
+
? selectedSnap.items
|
|
339
|
+
: null;
|
|
258
340
|
if (rawPreviously !== undefined && previouslySnap === null) {
|
|
259
341
|
return { kind: 'malformed', why: 'envelope_unreadable' };
|
|
260
342
|
}
|
|
@@ -277,7 +359,7 @@ export function readMemoryEraseReceipt(body) {
|
|
|
277
359
|
continue;
|
|
278
360
|
}
|
|
279
361
|
erasedSeen.add(id);
|
|
280
|
-
erased.push({ id, rev, binding: erasedBindingOf(item.binding) });
|
|
362
|
+
erased.push({ id, rev, binding: erasedBindingOf(item.binding, slugRule) });
|
|
281
363
|
}
|
|
282
364
|
catch {
|
|
283
365
|
erasedDropped++;
|
|
@@ -367,6 +449,18 @@ export function readMemoryEraseReceipt(body) {
|
|
|
367
449
|
}
|
|
368
450
|
erasedPreviously = rows;
|
|
369
451
|
}
|
|
452
|
+
const residuals = rule.carrierTable ? eraseResidualsOf(o, evidenceCapability) : null;
|
|
453
|
+
const partialCause = erasePartialCauseOf({
|
|
454
|
+
status,
|
|
455
|
+
custodyState,
|
|
456
|
+
pinnedIds,
|
|
457
|
+
erased,
|
|
458
|
+
erasedPreviously,
|
|
459
|
+
notFound,
|
|
460
|
+
conflicts,
|
|
461
|
+
dropped: erasedDropped + notFoundDropped + erasedPreviouslyDropped + conflictsDropped,
|
|
462
|
+
residuals,
|
|
463
|
+
});
|
|
370
464
|
return {
|
|
371
465
|
kind: 'present',
|
|
372
466
|
requestId: rawRequestId,
|
|
@@ -382,6 +476,8 @@ export function readMemoryEraseReceipt(body) {
|
|
|
382
476
|
erasedPreviouslyDropped,
|
|
383
477
|
conflicts,
|
|
384
478
|
conflictsDropped,
|
|
479
|
+
residuals,
|
|
480
|
+
partialCause,
|
|
385
481
|
};
|
|
386
482
|
}
|
|
387
483
|
export function memoryEraseCounts(reading) {
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { WiringManifestModRefusedView } from './adapter/downstream/eventToSdkMessage.js';
|
|
2
|
+
import type { EngineNoticeChromeEvent } from './seam.js';
|
|
3
|
+
import type { UiLanguage } from './env/uiLanguage.js';
|
|
4
|
+
export declare const MOD_LOADER_VERBS: readonly ["list", "load", "unload", "status"];
|
|
5
|
+
export type ModLoaderVerb = (typeof MOD_LOADER_VERBS)[number];
|
|
6
|
+
export declare function readModRegistrationRefusedNotice(ev: EngineNoticeChromeEvent): WiringManifestModRefusedView | undefined;
|
|
7
|
+
export declare function modCardSentence(input: object | null | undefined, lang?: UiLanguage): string | undefined;
|
|
8
|
+
export declare function modLoaderFailureSentence(name: string, error: unknown, lang?: UiLanguage): string;
|
package/dist/modsFace.js
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { modRowsOf } from './adapter/downstream/wiringManifestView.js';
|
|
2
|
+
import { msg, renderMessage } from './i18n/translate.js';
|
|
3
|
+
import { displayUntrusted } from './displayUntrusted.js';
|
|
4
|
+
import { WIRE_FAILURE_UNRENDERABLE_TEXT, wireFailureTextsOf } from './wireFailureShape.js';
|
|
5
|
+
import { gateOutcomeOf, isDeniedGate, rewriteExtensionNamesOf, toolInputRewriteOf } from './gateOutcome.js';
|
|
6
|
+
import { guardedRead, readOwnDataNonEmptyString, readOwnDataValue, toolResultBlockOf } from './ownKey.js';
|
|
7
|
+
const isCardRecordObject = (v) => typeof v === 'object' && v !== null && !Array.isArray(v);
|
|
8
|
+
export const MOD_LOADER_VERBS = Object.freeze(['list', 'load', 'unload', 'status']);
|
|
9
|
+
const modRowOf = (r) => modRowsOf([r])?.[0];
|
|
10
|
+
const MODS_REGISTRATION_REFUSED_NOTICE_CODE = 'mods.registration_refused';
|
|
11
|
+
export function readModRegistrationRefusedNotice(ev) {
|
|
12
|
+
try {
|
|
13
|
+
if (!isCardRecordObject(ev))
|
|
14
|
+
return undefined;
|
|
15
|
+
if (readOwnDataValue(ev, 'code') !== MODS_REGISTRATION_REFUSED_NOTICE_CODE)
|
|
16
|
+
return undefined;
|
|
17
|
+
const row = modRowOf(readOwnDataValue(ev, 'detail'));
|
|
18
|
+
return row !== undefined && 'refusedBy' in row ? row : undefined;
|
|
19
|
+
}
|
|
20
|
+
catch {
|
|
21
|
+
return undefined;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
const MOD_NAME_SHOWN_MAX = 64;
|
|
25
|
+
const MOD_REASON_SHOWN_MAX = 160;
|
|
26
|
+
const shownName = (s) => displayUntrusted(s, { blanks: true, max: MOD_NAME_SHOWN_MAX });
|
|
27
|
+
const shownReason = (s) => displayUntrusted(s, { max: MOD_REASON_SHOWN_MAX });
|
|
28
|
+
export function modCardSentence(input, lang) {
|
|
29
|
+
try {
|
|
30
|
+
if (!isCardRecordObject(input))
|
|
31
|
+
return undefined;
|
|
32
|
+
if (toolResultBlockOf(input) !== undefined) {
|
|
33
|
+
const by = readOwnDataNonEmptyString(input, '_sema_answered_by');
|
|
34
|
+
if (by === undefined) {
|
|
35
|
+
const names = rewriteExtensionNamesOf(toolInputRewriteOf({ rewrite: readOwnDataValue(input, '_sema_rewrite') }));
|
|
36
|
+
if (names.length === 0)
|
|
37
|
+
return undefined;
|
|
38
|
+
return renderMessage(msg('config.mods.rewrite.inputBy', { by: names.map(shownName).join(', ') }), lang);
|
|
39
|
+
}
|
|
40
|
+
const gate = gateOutcomeOf({ gate: readOwnDataValue(input, '_sema_gate') });
|
|
41
|
+
return isDeniedGate(gate)
|
|
42
|
+
? renderMessage(msg('config.mods.refusal.by', { by: shownName(by) }), lang)
|
|
43
|
+
: renderMessage(msg('config.mods.rewrite.resultInPlace', { by: shownName(by) }), lang);
|
|
44
|
+
}
|
|
45
|
+
const row = modRowOf(input);
|
|
46
|
+
if (row === undefined)
|
|
47
|
+
return undefined;
|
|
48
|
+
if ('refusedBy' in row) {
|
|
49
|
+
return renderMessage(msg('config.mods.card.refused', { name: shownName(row.name), refusedBy: shownName(row.refusedBy), reason: shownReason(row.reason) }), lang);
|
|
50
|
+
}
|
|
51
|
+
return renderMessage(msg('config.mods.card.mounted', { name: shownName(row.name) }), lang);
|
|
52
|
+
}
|
|
53
|
+
catch {
|
|
54
|
+
return undefined;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
export function modLoaderFailureSentence(name, error, lang) {
|
|
58
|
+
const shown = guardedRead(() => (typeof name === 'string' ? shownName(name) : undefined)) ?? '';
|
|
59
|
+
const { reason } = wireFailureTextsOf(error);
|
|
60
|
+
if (reason === WIRE_FAILURE_UNRENDERABLE_TEXT)
|
|
61
|
+
return renderMessage(msg('config.mods.loader.failedNoReason', { name: shown }), lang);
|
|
62
|
+
return renderMessage(msg('config.mods.loader.failed', { name: shown, reason: shownReason(reason) }), lang);
|
|
63
|
+
}
|
package/dist/ownKey.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ export declare function readOwnDataFiniteNumber(v: object | null | undefined, ke
|
|
|
6
6
|
export declare function readOwnDataValue<T>(v: object | null | undefined, key: string): T | undefined;
|
|
7
7
|
export declare function carriesAnswerText(text: string): boolean;
|
|
8
8
|
export declare function appendOwnElement<T>(list: T[], value: T): void;
|
|
9
|
+
export declare function toolResultBlockOf(record: object): object | undefined;
|
|
9
10
|
export declare function guardedRead<T>(read: () => T | undefined): T | undefined;
|
|
10
11
|
export declare function ownDataField(v: object, key: string): unknown;
|
|
11
12
|
export declare function ownSendableField(v: object, key: string): unknown;
|
package/dist/ownKey.js
CHANGED
|
@@ -40,6 +40,21 @@ export function carriesAnswerText(text) {
|
|
|
40
40
|
export function appendOwnElement(list, value) {
|
|
41
41
|
Object.defineProperty(list, list.length, { value, writable: true, enumerable: true, configurable: true });
|
|
42
42
|
}
|
|
43
|
+
export function toolResultBlockOf(record) {
|
|
44
|
+
const isRecord = (v) => typeof v === 'object' && v !== null && !Array.isArray(v);
|
|
45
|
+
const message = ownDataField(record, 'message');
|
|
46
|
+
if (!isRecord(message))
|
|
47
|
+
return undefined;
|
|
48
|
+
const content = ownDataField(message, 'content');
|
|
49
|
+
if (!Array.isArray(content))
|
|
50
|
+
return undefined;
|
|
51
|
+
for (let i = 0; i < content.length; i++) {
|
|
52
|
+
const block = ownDataField(content, String(i));
|
|
53
|
+
if (isRecord(block) && ownDataField(block, 'type') === 'tool_result')
|
|
54
|
+
return block;
|
|
55
|
+
}
|
|
56
|
+
return undefined;
|
|
57
|
+
}
|
|
43
58
|
export function guardedRead(read) {
|
|
44
59
|
try {
|
|
45
60
|
return read();
|
package/dist/postureKnob.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { capForDisplay } from './fleetTaskDesc.js';
|
|
2
|
-
export const POSTURE_SOURCE_WORDS = Object.freeze(['env', 'center', 'posture', 'engine-default']);
|
|
2
|
+
export const POSTURE_SOURCE_WORDS = Object.freeze(['env', 'center', 'lane', 'posture', 'engine-default']);
|
|
3
3
|
export function postureSourceIsOperatorPinned(source) {
|
|
4
4
|
return source === 'env' || source === 'center';
|
|
5
5
|
}
|
package/dist/prepareRefusal.d.ts
CHANGED
|
@@ -6,4 +6,3 @@ export interface PrepareRefusalNoteFacts {
|
|
|
6
6
|
}
|
|
7
7
|
export declare function prepareRefusalNoteOf(code: string | undefined, facts?: PrepareRefusalNoteFacts): string | undefined;
|
|
8
8
|
export declare function prepareRefusalCodeOf(failure: {} | null | undefined): PrepareRefusalCode | undefined;
|
|
9
|
-
export declare function imageInvalidFailureNoteOf(code: string | undefined): string | undefined;
|
package/dist/prepareRefusal.js
CHANGED
|
@@ -41,7 +41,7 @@ export function toolEndResultToUserFrame(arm) {
|
|
|
41
41
|
parent_tool_use_id: parent,
|
|
42
42
|
...(isCcToolDenialKind(arm._sema_denial_kind) ? { _sema_denial_kind: arm._sema_denial_kind } : {}),
|
|
43
43
|
...(gateView !== undefined ? { _sema_gate: gateView } : {}),
|
|
44
|
-
...toolResultRowFlagParts(arm),
|
|
44
|
+
...toolResultRowFlagParts(arm, gateView),
|
|
45
45
|
...(Object.hasOwn(envelope, 'tool_use_result') ? { tool_use_result: envelope.tool_use_result } : {}),
|
|
46
46
|
...(Object.hasOwn(envelope, '_sema_degraded') ? { _sema_degraded: envelope._sema_degraded } : {}),
|
|
47
47
|
uuid: rowIdentity.uuid,
|
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
import type { TaskRequest } from '@sema-agent/sdk';
|
|
2
1
|
import { type EnvLike } from './hostEnv.js';
|
|
3
|
-
export
|
|
4
|
-
export declare function promptProfileFromEnv(env?: EnvLike): PromptProfile | undefined;
|
|
2
|
+
export declare function promptLeanFromEnv(env?: EnvLike): false | undefined;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { hostEnv } from './hostEnv.js';
|
|
2
2
|
const PROMPT_PROFILE_ENV = 'SEMA_PROMPT_PROFILE';
|
|
3
|
-
export function
|
|
3
|
+
export function promptLeanFromEnv(env = hostEnv()) {
|
|
4
4
|
const raw = env[PROMPT_PROFILE_ENV];
|
|
5
5
|
const s = typeof raw === 'string' ? raw.trim().toLowerCase() : '';
|
|
6
|
-
return s === '
|
|
6
|
+
return s === 'classic' ? false : undefined;
|
|
7
7
|
}
|
|
@@ -16,7 +16,7 @@ export const PRINT_NOTIFICATION_FIELD_MATRIX = [
|
|
|
16
16
|
{ field: '_sema_partial', from: 'partial', cc: false, why: 'server 1.258:被终止子代的残果(消费方须渲成不完整,不得当完整结果)' },
|
|
17
17
|
{ field: '_sema_exit_code', from: 'exitCode', cc: false, why: '后台 bash 退出码(137=OOM 这类归因只在这一位上)' },
|
|
18
18
|
{ field: '_sema_diagnostics', from: 'diagnostics', cc: false, why: '引擎侧诊断串(UNTRUSTED,service 已 redact)' },
|
|
19
|
-
{ field: '_sema_result', from: 'result', cc: false, why: '完成结果正文(
|
|
19
|
+
{ field: '_sema_result', from: 'result', cc: false, why: '完成结果正文(帧带 result 必入 XML,print 出口同理不得独漏)' },
|
|
20
20
|
{ field: '_sema_lines', from: 'lines', cc: false, why: '尾部输出行(UNTRUSTED);交互面折进 <output-lines>' },
|
|
21
21
|
{ field: '_sema_recent_steps', from: 'recentSteps', cc: false, why: '结构化残局步骤 {tool,target,outcome}[] —— **原样透传**,不降级成交互面那份显示串(SDK 消费方要结构)' },
|
|
22
22
|
{ field: '_sema_edited_files', from: 'editedFiles', cc: false, why: '结构化改档清单 {path,edits}[];同上原样透传' },
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { TaskRequest, UserAttachment } from '@sema-agent/sdk';
|
|
2
|
+
import { type ThinkingLatchState } from '../thinkingLatchWords.js';
|
|
2
3
|
import { type ApprovalFrameFamiliesReading, type ApprovalFrameFamiliesWithheld } from '../approvalFrameFamilies.js';
|
|
3
4
|
import { type OutputStyleSeatReading } from '../outputStyleSeatCapability.js';
|
|
4
5
|
import { type ApprovalReachWord } from '../approvalReachWire.js';
|
|
@@ -38,7 +39,7 @@ export interface TaskRequestInput {
|
|
|
38
39
|
selfOrchestration?: boolean;
|
|
39
40
|
deferTools?: readonly string[];
|
|
40
41
|
retainBackgroundProcesses?: boolean;
|
|
41
|
-
|
|
42
|
+
promptLean?: boolean;
|
|
42
43
|
enableFork?: boolean;
|
|
43
44
|
attachments?: Record<string, unknown>;
|
|
44
45
|
attachmentIds?: readonly string[];
|
|
@@ -66,6 +67,8 @@ export interface TaskRequestInput {
|
|
|
66
67
|
repo?: string;
|
|
67
68
|
hostSettings: HostTurnSettings;
|
|
68
69
|
approvalFrameFamiliesReading?: ApprovalFrameFamiliesReading;
|
|
70
|
+
thinkingLatch?: 'on' | 'off';
|
|
71
|
+
reasoningFloor?: string;
|
|
69
72
|
settings?: {
|
|
70
73
|
ultracode?: boolean;
|
|
71
74
|
};
|
|
@@ -84,6 +87,23 @@ export interface TaskRequestAssembly {
|
|
|
84
87
|
readonly omitted: readonly TaskRequestOmission[];
|
|
85
88
|
readonly host: HostTurnSettings;
|
|
86
89
|
readonly approvalFrameFamiliesWithheld?: ApprovalFrameFamiliesWithheld;
|
|
90
|
+
readonly thinking: ThinkingTurnProjection;
|
|
91
|
+
}
|
|
92
|
+
export interface ThinkingTurnInput {
|
|
93
|
+
readonly submission: RequestLane | SubmissionIdentity;
|
|
94
|
+
readonly live: boolean;
|
|
95
|
+
readonly latch?: 'on' | 'off';
|
|
96
|
+
readonly strength?: unknown;
|
|
97
|
+
readonly floor?: string;
|
|
98
|
+
readonly ultracode?: boolean;
|
|
99
|
+
}
|
|
100
|
+
export interface ThinkingTurnProjection {
|
|
101
|
+
readonly word?: unknown;
|
|
102
|
+
readonly verdict: 'utility_lane' | 'off' | 'strength';
|
|
103
|
+
readonly latch: ThinkingLatchState;
|
|
104
|
+
readonly ultracodeStamped: boolean;
|
|
105
|
+
readonly floorApplied?: true;
|
|
106
|
+
readonly strengthOverruled?: unknown;
|
|
87
107
|
}
|
|
88
108
|
export type TaskRequestSeatReading = {
|
|
89
109
|
readonly seat: 'seated';
|
|
@@ -136,6 +156,7 @@ export type MaxCostUsdParse = {
|
|
|
136
156
|
export declare function parseMaxCostUsd(text: unknown): MaxCostUsdParse;
|
|
137
157
|
export declare function assembleTaskRequest(input: TaskRequestInput, laneOrIdentity: RequestLane | SubmissionIdentity): TaskRequestAssembly;
|
|
138
158
|
export declare function buildTaskRequest(input: TaskRequestInput, laneOrIdentity: RequestLane | SubmissionIdentity): TaskRequestLike;
|
|
159
|
+
export declare function thinkingTurnProjection(input: ThinkingTurnInput): ThinkingTurnProjection;
|
|
139
160
|
export interface LiveDefaultsInput {
|
|
140
161
|
cwd?: string;
|
|
141
162
|
additionalDirectories?: readonly string[];
|