@sema-agent/client-core 0.111.0 → 0.112.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.
Files changed (115) hide show
  1. package/CHANGELOG.md +98 -0
  2. package/README.md +16 -7
  3. package/dist/agentSession/engineSessionBackgroundStop.js +2 -2
  4. package/dist/checkpointRowVerdict.d.ts +3 -0
  5. package/dist/checkpointRowVerdict.js +14 -1
  6. package/dist/consoleCaPin.d.ts +136 -0
  7. package/dist/consoleCaPin.js +827 -0
  8. package/dist/decideReceipt.d.ts +2 -1
  9. package/dist/deviceRebind.js +3 -3
  10. package/dist/effectiveFacts.d.ts +9 -0
  11. package/dist/effectiveFacts.js +33 -0
  12. package/dist/engineAddress.d.ts +1 -0
  13. package/dist/engineAddress.js +4 -1
  14. package/dist/engineCredentialRelease.d.ts +54 -0
  15. package/dist/engineCredentialRelease.js +146 -0
  16. package/dist/engineErrorCodes.d.ts +1 -0
  17. package/dist/engineErrorCodes.js +1 -0
  18. package/dist/engineHealthFacts.d.ts +0 -11
  19. package/dist/engineHealthFacts.js +0 -21
  20. package/dist/engineHealthProbeVerdict.d.ts +1 -0
  21. package/dist/engineHealthProbeVerdict.js +21 -13
  22. package/dist/engineUnavailable.d.ts +3 -2
  23. package/dist/engineUnavailable.js +16 -12
  24. package/dist/engineUrl.js +4 -2
  25. package/dist/gateFailureCodes.js +2 -2
  26. package/dist/generated/sdkFactTables.d.ts +1 -0
  27. package/dist/generated/sdkFactTables.js +13 -0
  28. package/dist/generated/settingsSchemaFns.d.ts +1 -0
  29. package/dist/generated/settingsSchemaFns.js +3 -0
  30. package/dist/generated/settingsSchemaHooksClassifier.js +38 -9
  31. package/dist/generated/settingsSchemaTables.d.ts +52 -0
  32. package/dist/generated/settingsSchemaTables.js +18 -0
  33. package/dist/generated/settingsSchemaTypes.d.ts +23 -13
  34. package/dist/generated/settingsSchemaUrlShape.d.ts +1 -0
  35. package/dist/generated/settingsSchemaUrlShape.js +17 -0
  36. package/dist/hitl/decisionRefusal.d.ts +4 -0
  37. package/dist/hitl/decisionRefusal.js +12 -2
  38. package/dist/hitl/hitlBridge.d.ts +1 -0
  39. package/dist/hitl/hitlBridge.js +17 -4
  40. package/dist/hitl/localAllowRedemption.d.ts +9 -6
  41. package/dist/hitl/localAllowRedemption.js +20 -0
  42. package/dist/hitl/parkOwnership.js +2 -1
  43. package/dist/hitl/parkResolver.js +7 -0
  44. package/dist/hitl/planReviewCard.d.ts +3 -2
  45. package/dist/hitl/planReviewCard.js +2 -0
  46. package/dist/hitl/planReviewWire.d.ts +4 -2
  47. package/dist/hitl/planReviewWire.js +134 -97
  48. package/dist/hitl/screenDecisionCards.js +3 -2
  49. package/dist/hitl/sessionPolicyWire.js +2 -2
  50. package/dist/hitl/standingRows.d.ts +4 -2
  51. package/dist/hitl/standingRows.js +10 -3
  52. package/dist/hooksReaderGenerations.js +1 -1
  53. package/dist/i18n/messages.en.d.ts +165 -0
  54. package/dist/i18n/messages.en.js +166 -1
  55. package/dist/i18n/messages.zh.js +177 -1
  56. package/dist/index.d.ts +30 -5
  57. package/dist/index.js +15 -2
  58. package/dist/liveModelCatalog.d.ts +4 -0
  59. package/dist/liveModelCatalog.js +10 -1
  60. package/dist/localConfig/documents.d.ts +61 -0
  61. package/dist/localConfig/documents.js +51 -0
  62. package/dist/localConfig/kernel.d.ts +149 -0
  63. package/dist/localConfig/kernel.js +597 -0
  64. package/dist/localConfig/mcp/edit.d.ts +161 -0
  65. package/dist/localConfig/mcp/edit.js +846 -0
  66. package/dist/localConfig/mcp/servers.d.ts +165 -0
  67. package/dist/localConfig/mcp/servers.js +776 -0
  68. package/dist/localConfig/mcp/views.d.ts +170 -0
  69. package/dist/localConfig/mcp/views.js +429 -0
  70. package/dist/localConfig/modelPool.d.ts +262 -0
  71. package/dist/localConfig/modelPool.js +1489 -0
  72. package/dist/localConfig/modelPoolWords.d.ts +13 -0
  73. package/dist/localConfig/modelPoolWords.js +20 -0
  74. package/dist/localConfig/receiptShape.d.ts +7 -0
  75. package/dist/localConfig/receiptShape.js +135 -0
  76. package/dist/localConfig/settingsWrite.d.ts +127 -0
  77. package/dist/localConfig/settingsWrite.js +237 -0
  78. package/dist/localConfig/skills.d.ts +124 -0
  79. package/dist/localConfig/skills.js +397 -0
  80. package/dist/localConfig/skillsWords.d.ts +10 -0
  81. package/dist/localConfig/skillsWords.js +5 -0
  82. package/dist/mcpProbeWire.js +2 -1
  83. package/dist/mcpWireCaps.js +1 -1
  84. package/dist/memoryVerbsWire.js +3 -2
  85. package/dist/model/onboardJudgement.d.ts +14 -4
  86. package/dist/model/onboardJudgement.js +91 -139
  87. package/dist/modelConfigGapNotice.d.ts +20 -0
  88. package/dist/modelConfigGapNotice.js +102 -0
  89. package/dist/modsKernelIdentity.js +2 -47
  90. package/dist/notifications.js +14 -12
  91. package/dist/ownKey.d.ts +1 -0
  92. package/dist/ownKey.js +40 -8
  93. package/dist/permissionsDeclaration.d.ts +2 -1
  94. package/dist/permissionsDeclaration.js +31 -17
  95. package/dist/planReviewOutcomeCause.d.ts +2 -0
  96. package/dist/planReviewOutcomeCause.js +12 -0
  97. package/dist/promptBlockedCopy.js +2 -2
  98. package/dist/resumeRefusalCopy.d.ts +3 -1
  99. package/dist/resumeRefusalCopy.js +12 -4
  100. package/dist/runLedgerSnapshot.js +3 -3
  101. package/dist/runPermissionModeSwitch.js +2 -3
  102. package/dist/seatContract.d.ts +154 -4
  103. package/dist/seatContract.js +228 -2
  104. package/dist/sessionIdSegment.d.ts +1 -0
  105. package/dist/sessionIdSegment.js +4 -1
  106. package/dist/sessionMemoryErase.js +2 -1
  107. package/dist/sha256Bytes.d.ts +1 -0
  108. package/dist/sha256Bytes.js +46 -0
  109. package/dist/skillOverrideChain.d.ts +83 -0
  110. package/dist/skillOverrideChain.js +378 -0
  111. package/dist/skillsWireCaps.d.ts +3 -0
  112. package/dist/skillsWireCaps.js +16 -1
  113. package/dist/turnFailurePresentation.js +4 -10
  114. package/docs/INTEGRATION-CLIENTS.md +680 -14
  115. package/package.json +3 -3
@@ -0,0 +1,378 @@
1
+ import { SETTINGS_IS_RESERVED_MEMBER_NAME } from './generated/settingsSchemaFns.js';
2
+ import { readOwnDataValue } from './ownKey.js';
3
+ export const SKILL_OVERRIDE_STATES = Object.freeze(['on', 'name-only', 'user-invocable-only', 'off']);
4
+ export const SKILL_ORIGINS = Object.freeze(['skills', 'synced', 'commands', 'mcp', 'plugin', 'builtin', 'bundled']);
5
+ export const SKILL_OVERRIDE_LAYERS = Object.freeze(['policySettings', 'flagSettings', 'localSettings', 'projectSettings', 'userSettings']);
6
+ export const SKILL_OVERRIDE_DECIDERS = Object.freeze([...SKILL_OVERRIDE_LAYERS, 'session', 'default', 'plugin', 'builtin_clamp', 'hidden_behind_plugin']);
7
+ export const SKILL_OVERRIDE_LOCK_SOURCES = Object.freeze(['policy', 'flag', 'plugin', 'skill-author', 'reserved-name']);
8
+ const MANAGED = ['policySettings', 'flagSettings'];
9
+ const PLAIN = ['localSettings', 'projectSettings', 'userSettings'];
10
+ const MERGED = ['policySettings', 'flagSettings', 'localSettings', 'projectSettings', 'userSettings'];
11
+ const RANK = { on: 0, 'name-only': 1, 'user-invocable-only': 2, off: 3 };
12
+ const LIST_BUDGET = 4096;
13
+ function own(v, key) {
14
+ if (typeof v !== 'object' || v === null)
15
+ return undefined;
16
+ try {
17
+ return readOwnDataValue(v, key);
18
+ }
19
+ catch {
20
+ return undefined;
21
+ }
22
+ }
23
+ const isState = (v) => typeof v === 'string' && SKILL_OVERRIDE_STATES.some((w) => w === v);
24
+ const isRecord = (v) => typeof v === 'object' && v !== null && !Array.isArray(v);
25
+ function stringsOf(v) {
26
+ const out = [];
27
+ if (!Array.isArray(v))
28
+ return out;
29
+ let n;
30
+ try {
31
+ n = own(v, 'length');
32
+ }
33
+ catch {
34
+ return out;
35
+ }
36
+ if (typeof n !== 'number' || !Number.isSafeInteger(n) || n < 0 || n > LIST_BUDGET)
37
+ return out;
38
+ for (let i = 0; i < n; i++) {
39
+ const s = own(v, String(i));
40
+ if (typeof s === 'string' && s !== '')
41
+ out.push(s);
42
+ }
43
+ return out;
44
+ }
45
+ export function shapeSkillSubject(v) {
46
+ if (!isRecord(v))
47
+ return undefined;
48
+ const name = own(v, 'name');
49
+ const originRaw = own(v, 'origin');
50
+ const origin = SKILL_ORIGINS.find((w) => w === originRaw);
51
+ if (typeof name !== 'string' || name === '' || origin === undefined)
52
+ return undefined;
53
+ const unq = own(v, 'unqualifiedName');
54
+ const synced = [];
55
+ const rawSynced = own(v, 'syncedNames');
56
+ if (Array.isArray(rawSynced)) {
57
+ const n = own(rawSynced, 'length');
58
+ if (typeof n === 'number' && Number.isSafeInteger(n) && n >= 0 && n <= LIST_BUDGET) {
59
+ for (let i = 0; i < n; i++) {
60
+ const e = own(rawSynced, String(i));
61
+ const sn = own(e, 'name');
62
+ const sb = own(e, 'bare');
63
+ if (typeof sn === 'string' && sn !== '' && typeof sb === 'string' && sb !== '')
64
+ synced.push(Object.freeze({ name: sn, bare: sb }));
65
+ }
66
+ }
67
+ }
68
+ return Object.freeze({
69
+ name,
70
+ origin,
71
+ unqualifiedName: typeof unq === 'string' && unq !== '' ? unq : undefined,
72
+ bareNameReserved: own(v, 'bareNameReserved') === true,
73
+ aliases: Object.freeze(stringsOf(own(v, 'aliases'))),
74
+ mcpLabels: Object.freeze(stringsOf(own(v, 'mcpLabels')).filter((s) => s.includes(':'))),
75
+ reservedLabels: Object.freeze(stringsOf(own(v, 'reservedLabels'))),
76
+ syncedNames: Object.freeze(synced),
77
+ followsSyncedSkillState: own(v, 'followsSyncedSkillState') === true,
78
+ disableModelInvocation: own(v, 'disableModelInvocation') === true,
79
+ hiddenBehindPlugin: own(v, 'hiddenBehindPlugin') === true,
80
+ });
81
+ }
82
+ function overridesOf(doc) {
83
+ const ov = own(doc, 'skillOverrides');
84
+ return isRecord(ov) ? ov : undefined;
85
+ }
86
+ export function shapeSkillLayers(v) {
87
+ const docs = {};
88
+ for (const l of SKILL_OVERRIDE_LAYERS)
89
+ docs[l] = overridesOf(own(v, l));
90
+ const disabled = new Set(stringsOf(own(v, 'disabledSources')));
91
+ const session = own(v, 'session');
92
+ const enabled = (layer) => layer === 'policySettings' || layer === 'flagSettings' || !disabled.has(layer);
93
+ let fromSettings = false;
94
+ for (const l of MERGED) {
95
+ if (!enabled(l))
96
+ continue;
97
+ const b = own(own(v, l), 'disableBundledSkills');
98
+ if (typeof b === 'boolean') {
99
+ fromSettings = b;
100
+ break;
101
+ }
102
+ }
103
+ return Object.freeze({
104
+ docs: Object.freeze(docs),
105
+ session: isRecord(session) ? session : undefined,
106
+ enabled,
107
+ bundledDisabled: fromSettings || own(v, 'bundledSkillsDisabledByEnv') === true,
108
+ });
109
+ }
110
+ function at(ov, key) {
111
+ if (ov === undefined || key === undefined)
112
+ return undefined;
113
+ const w = own(ov, key);
114
+ return isState(w) ? w : undefined;
115
+ }
116
+ const hitAt = (ov, key, by) => {
117
+ const w = at(ov, key);
118
+ return w === undefined ? undefined : { value: w, by };
119
+ };
120
+ function stricter(a, b) {
121
+ if (a === undefined)
122
+ return b;
123
+ return b !== undefined && RANK[b.value] > RANK[a.value] ? b : a;
124
+ }
125
+ function strictestIn(ov, names, by) {
126
+ let r;
127
+ for (const n of names) {
128
+ const w = at(ov, n);
129
+ if (w !== undefined && (r === undefined || RANK[w] > RANK[r.value]))
130
+ r = { value: w, by };
131
+ }
132
+ return r;
133
+ }
134
+ export function bareNameOf(s) {
135
+ if (s.unqualifiedName === undefined)
136
+ return undefined;
137
+ if (s.origin !== 'synced')
138
+ return s.unqualifiedName;
139
+ return s.bareNameReserved ? undefined : s.unqualifiedName;
140
+ }
141
+ const freeLabels = (s) => s.mcpLabels.filter((l) => !s.reservedLabels.includes(l));
142
+ function aliasNamesOf(s) {
143
+ return [...s.aliases, ...(s.unqualifiedName !== undefined ? [s.unqualifiedName] : []), ...freeLabels(s)];
144
+ }
145
+ export function secondaryNamesOf(s) {
146
+ const bare = bareNameOf(s);
147
+ return [...(bare !== undefined ? [bare] : []), ...(s.origin === 'mcp' ? freeLabels(s) : [])];
148
+ }
149
+ function reservedTighten(ov, s, by) {
150
+ const r = strictestIn(ov, s.reservedLabels, by);
151
+ return r === undefined || r.value === 'on' ? undefined : r;
152
+ }
153
+ function mergedAt(L, key) {
154
+ for (const l of MERGED) {
155
+ if (!L.enabled(l))
156
+ continue;
157
+ const h = hitAt(L.docs[l], key, l);
158
+ if (h !== undefined)
159
+ return h;
160
+ }
161
+ return undefined;
162
+ }
163
+ function viewThenSession(L, names) {
164
+ for (const n of names) {
165
+ const h = mergedAt(L, n);
166
+ if (h !== undefined)
167
+ return h;
168
+ }
169
+ for (const n of names) {
170
+ const h = hitAt(L.session, n, 'session');
171
+ if (h !== undefined)
172
+ return h;
173
+ }
174
+ return undefined;
175
+ }
176
+ function managedOnly(L, names) {
177
+ for (const n of names)
178
+ for (const l of MANAGED) {
179
+ const h = hitAt(L.docs[l], n, l);
180
+ if (h !== undefined)
181
+ return h;
182
+ }
183
+ return undefined;
184
+ }
185
+ function mcpChain(L, s, rest) {
186
+ const names = [s.name, ...rest];
187
+ let m;
188
+ let tight;
189
+ for (const l of MANAGED) {
190
+ m = stricter(m, strictestIn(L.docs[l], names, l));
191
+ tight = stricter(tight, reservedTighten(L.docs[l], s, l));
192
+ }
193
+ if (m !== undefined)
194
+ return stricter(m, tight);
195
+ for (const l of PLAIN) {
196
+ if (!L.enabled(l))
197
+ continue;
198
+ const b = strictestIn(L.docs[l], names, l);
199
+ if (b !== undefined)
200
+ return stricter(b, tight);
201
+ }
202
+ return stricter(strictestIn(L.session, names, 'session'), tight);
203
+ }
204
+ function overrideChain(L, s, mode) {
205
+ const rest = secondaryNamesOf(s);
206
+ if (s.origin === 'mcp')
207
+ return mcpChain(L, s, rest);
208
+ let v = (mode === 'all' ? viewThenSession : managedOnly)(L, [s.name, ...rest]);
209
+ const aliases = aliasNamesOf(s);
210
+ if (aliases.length === 0)
211
+ return v;
212
+ for (const l of MANAGED) {
213
+ const ov = L.docs[l];
214
+ if (at(ov, s.name) !== undefined)
215
+ break;
216
+ const w = strictestIn(ov, aliases, l);
217
+ if (w !== undefined && (v === undefined || RANK[w.value] > RANK[v.value]))
218
+ v = w;
219
+ if (rest.some((d) => at(ov, d) !== undefined))
220
+ break;
221
+ }
222
+ return v;
223
+ }
224
+ function managedLock(L, s, mode) {
225
+ const aliases = aliasNamesOf(s);
226
+ let found;
227
+ for (const l of MANAGED) {
228
+ const ov = L.docs[l];
229
+ const b = s.origin === 'mcp'
230
+ ? stricter(strictestIn(ov, [s.name, ...aliases], l), reservedTighten(ov, s, l))?.value
231
+ : (at(ov, s.name) ?? strictestIn(ov, aliases, l)?.value ?? reservedTighten(ov, s, l)?.value);
232
+ if (b === undefined)
233
+ continue;
234
+ if (s.origin !== 'mcp') {
235
+ found = { value: b, source: l };
236
+ break;
237
+ }
238
+ if (found === undefined || RANK[b] > RANK[found.value])
239
+ found = { value: b, source: l };
240
+ }
241
+ if (found === undefined)
242
+ return undefined;
243
+ const chain = overrideChain(L, s, mode);
244
+ return chain !== undefined ? { value: chain.value, source: found.source, by: chain.by } : { value: found.value, source: found.source, by: found.source };
245
+ }
246
+ function pluginManaged(L, s) {
247
+ if (s.origin !== 'plugin')
248
+ return managedLock(L, s, 'all');
249
+ let n;
250
+ for (const sn of s.syncedNames) {
251
+ const h = Object.freeze({
252
+ ...EMPTY_SUBJECT,
253
+ name: sn.name,
254
+ origin: 'synced',
255
+ unqualifiedName: sn.bare,
256
+ bareNameReserved: !s.aliases.includes(sn.bare),
257
+ });
258
+ const y = managedLock(L, h, 'administrator');
259
+ if (y !== undefined && (n === undefined || RANK[y.value] > RANK[n.value]))
260
+ n = y;
261
+ }
262
+ return n;
263
+ }
264
+ const EMPTY_SUBJECT = Object.freeze({
265
+ name: '',
266
+ origin: 'skills',
267
+ unqualifiedName: undefined,
268
+ bareNameReserved: false,
269
+ aliases: Object.freeze([]),
270
+ mcpLabels: Object.freeze([]),
271
+ reservedLabels: Object.freeze([]),
272
+ syncedNames: Object.freeze([]),
273
+ followsSyncedSkillState: false,
274
+ disableModelInvocation: false,
275
+ hiddenBehindPlugin: false,
276
+ });
277
+ function pluginFollow(L, s) {
278
+ let r;
279
+ for (const sn of s.syncedNames) {
280
+ const y = viewThenSession(L, s.followsSyncedSkillState || s.aliases.includes(sn.bare) ? [sn.name, sn.bare] : [sn.name]);
281
+ if (s.followsSyncedSkillState || y?.value === 'user-invocable-only')
282
+ r = stricter(r, y);
283
+ }
284
+ return r;
285
+ }
286
+ const effective = (value, decidedBy) => Object.freeze({ value, decidedBy });
287
+ export function effectiveOfShaped(L, s) {
288
+ if (s.hiddenBehindPlugin)
289
+ return effective('off', 'hidden_behind_plugin');
290
+ if (s.origin === 'plugin') {
291
+ const m = pluginManaged(L, s);
292
+ const v = stricter(m === undefined ? undefined : { value: m.value, by: m.by }, pluginFollow(L, s));
293
+ return v === undefined ? effective('on', 'default') : effective(v.value, v.by);
294
+ }
295
+ const r = overrideChain(L, s, 'all');
296
+ const value = r?.value ?? 'on';
297
+ if (s.origin === 'builtin' && L.bundledDisabled)
298
+ return value === 'off' ? effective('off', r?.by ?? 'default') : effective('user-invocable-only', 'builtin_clamp');
299
+ return effective(value, r?.by ?? 'default');
300
+ }
301
+ const locked = (value, source) => Object.freeze({ value, source });
302
+ export function lockOfShaped(L, s) {
303
+ const n = pluginManaged(L, s);
304
+ if (n !== undefined) {
305
+ const t = s.origin === 'plugin' ? effectiveOfShaped(L, s).value : n.value;
306
+ return locked(t, t !== n.value ? 'plugin' : n.source === 'policySettings' ? 'policy' : 'flag');
307
+ }
308
+ if (SETTINGS_IS_RESERVED_MEMBER_NAME(s.name))
309
+ return locked(s.disableModelInvocation ? 'user-invocable-only' : 'on', 'reserved-name');
310
+ if (s.disableModelInvocation)
311
+ return locked('user-invocable-only', 'skill-author');
312
+ if (s.origin === 'plugin')
313
+ return locked(effectiveOfShaped(L, s).value, 'plugin');
314
+ return undefined;
315
+ }
316
+ export function skillOverrideEffectiveOf(layers, skill) {
317
+ try {
318
+ const s = shapeSkillSubject(skill);
319
+ if (s === undefined)
320
+ return undefined;
321
+ return effectiveOfShaped(shapeSkillLayers(layers), s);
322
+ }
323
+ catch {
324
+ return undefined;
325
+ }
326
+ }
327
+ export function skillOverrideLockOf(layers, skill) {
328
+ try {
329
+ const s = shapeSkillSubject(skill);
330
+ if (s === undefined)
331
+ return locked('on', 'reserved-name');
332
+ return lockOfShaped(shapeSkillLayers(layers), s);
333
+ }
334
+ catch {
335
+ return locked('on', 'reserved-name');
336
+ }
337
+ }
338
+ export function ownValueIn(ov, s) {
339
+ return s.origin === 'mcp' ? strictestIn(ov, [s.name, ...secondaryNamesOf(s)], 'default')?.value : at(ov, s.name);
340
+ }
341
+ export function stateAt(ov, key) {
342
+ return at(ov, key);
343
+ }
344
+ export function lowerTierOf(L, s, target, skipTargetBare) {
345
+ const doc = (l) => ((l === 'localSettings' && target === 'localSettings') || L.enabled(l) ? L.docs[l] : undefined);
346
+ if (s.origin === 'mcp') {
347
+ if (target === 'userSettings')
348
+ return undefined;
349
+ const names = [s.name, ...secondaryNamesOf(s)];
350
+ for (const l of ['projectSettings', 'userSettings']) {
351
+ if (!L.enabled(l))
352
+ continue;
353
+ const m = strictestIn(L.docs[l], names, l);
354
+ if (m !== undefined)
355
+ return m.value;
356
+ }
357
+ return undefined;
358
+ }
359
+ const bare = bareNameOf(s);
360
+ const bareChain = () => {
361
+ if (bare === undefined)
362
+ return undefined;
363
+ for (const l of PLAIN) {
364
+ if (skipTargetBare && l === target)
365
+ continue;
366
+ const w = at(doc(l), bare);
367
+ if (w !== undefined)
368
+ return w;
369
+ }
370
+ return undefined;
371
+ };
372
+ if (target === 'userSettings')
373
+ return bareChain();
374
+ return at(doc('projectSettings'), s.name) ?? at(doc('userSettings'), s.name) ?? bareChain();
375
+ }
376
+ export function withLayerDoc(L, layer, doc) {
377
+ return Object.freeze({ ...L, docs: Object.freeze({ ...L.docs, [layer]: overridesOf(doc) }) });
378
+ }
@@ -1,5 +1,6 @@
1
1
  import type { SkillSpec } from '@sema-agent/sdk';
2
2
  import { type SkillToolListsReading } from './skillToolListsCapability.js';
3
+ import { type SkillOverrideLayers, type SkillOverrideSubject } from './skillOverrideChain.js';
3
4
  export interface SkillCmdLike {
4
5
  type?: string;
5
6
  name?: string;
@@ -10,6 +11,7 @@ export interface SkillCmdLike {
10
11
  skillRoot?: string;
11
12
  allowedTools?: readonly string[];
12
13
  disallowedTools?: readonly string[];
14
+ skillOverrideSubject?: SkillOverrideSubject;
13
15
  }
14
16
  export declare function toCappedSpec(name: string, description: string, whenToUse: string, body: string): SkillSpec | null;
15
17
  export type SkillSpecOnWire = SkillSpec & {
@@ -19,6 +21,7 @@ export interface SkillSpecsOptions {
19
21
  toolsRunHere?: boolean;
20
22
  platform?: 'posix' | 'win32';
21
23
  skillToolLists?: SkillToolListsReading;
24
+ skillOverrides?: SkillOverrideLayers;
22
25
  }
23
26
  export declare function skillBaseDirOf(skillRoot: string | undefined, platform?: 'posix' | 'win32'): string | undefined;
24
27
  export type SkillToolListKey = 'allowedTools' | 'disallowedTools';
@@ -1,6 +1,7 @@
1
1
  import { skillToolListsAvailable } from './skillToolListsCapability.js';
2
2
  import { msg, renderMessage } from './i18n/translate.js';
3
3
  import { appendOwnElement } from './ownKey.js';
4
+ import { skillOverrideEffectiveOf } from './skillOverrideChain.js';
4
5
  export function toCappedSpec(name, description, whenToUse, body) {
5
6
  const n = name.trim();
6
7
  const c = body.trim();
@@ -11,6 +12,13 @@ export function toCappedSpec(name, description, whenToUse, body) {
11
12
  .join(' — ');
12
13
  return { name: n, description: desc, content: c };
13
14
  }
15
+ const ORIGIN_OF_SOURCE = { plugin: 'plugin', builtin: 'builtin', bundled: 'bundled', mcp: 'mcp' };
16
+ function overrideSubjectOf(cmd, name) {
17
+ if (cmd.skillOverrideSubject !== undefined)
18
+ return cmd.skillOverrideSubject;
19
+ const src = typeof cmd.source === 'string' && Object.hasOwn(ORIGIN_OF_SOURCE, cmd.source) ? ORIGIN_OF_SOURCE[cmd.source] : undefined;
20
+ return { name, origin: src ?? 'skills' };
21
+ }
14
22
  export function skillBaseDirOf(skillRoot, platform = 'posix') {
15
23
  if (skillRoot === undefined || skillRoot.length === 0 || skillRoot.length > 4096)
16
24
  return undefined;
@@ -120,10 +128,17 @@ export function skillCommandsToSpecs(cmds, resolveBody, opts) {
120
128
  for (const cmd of cmds) {
121
129
  if (cmd.type !== 'prompt' || cmd.disableModelInvocation)
122
130
  continue;
131
+ let nameOnly = false;
132
+ if (opts?.skillOverrides !== undefined) {
133
+ const eff = skillOverrideEffectiveOf(opts.skillOverrides, overrideSubjectOf(cmd, (cmd.name ?? '').trim()));
134
+ if (eff === undefined || eff.value === 'off' || eff.value === 'user-invocable-only')
135
+ continue;
136
+ nameOnly = eff.value === 'name-only';
137
+ }
123
138
  const body = resolveBody(cmd);
124
139
  if (!body)
125
140
  continue;
126
- const spec = toCappedSpec(cmd.name ?? '', cmd.description ?? '', cmd.whenToUse ?? '', body);
141
+ const spec = toCappedSpec(cmd.name ?? '', nameOnly ? '' : (cmd.description ?? ''), nameOnly ? '' : (cmd.whenToUse ?? ''), body);
127
142
  if (!spec || seen.has(spec.name))
128
143
  continue;
129
144
  seen.add(spec.name);
@@ -3,7 +3,8 @@ import { classifyTurnWireError, isPreStreamDrainingReject } from './wireErrorTri
3
3
  import { isSseIdleError, streamEndedReasonOf } from './sseIdleTriage.js';
4
4
  import { runNotFollowedOf } from './runFollow.js';
5
5
  import { isCodeClassifiedGateFailure } from './gateFailureCodes.js';
6
- import { CORRUPT_ROW_ERROR_CODE, CORRUPT_SESSION_ERROR_CODE, MEMORY_CONTROL_PLANE_CORRUPT, SCENARIO_ASSIGNMENT_UNKNOWN_ERROR_CODE } from './engineErrorCodes.js';
6
+ import { DRAINING_ERROR_CODE } from './engineErrorCodes.js';
7
+ import { SDK_NON_RETRYABLE_CODES } from './generated/sdkFactTables.js';
7
8
  import { admissionWallRefusalContent, admissionWallRefusalFromError, bodyShapeRefusalFromError, bodyShapeRefusalTouchesSettings, fleetLeaseUnavailableContent, fleetLeaseUnavailableFromError, hostPostureRefusalContent, hostPostureRefusalFromError, fieldLimitRefusalContent, fieldLimitRefusalFromError, toolDeclarationRefusalContent, toolDeclarationRefusalFromError, usageWindowExhaustedContent, usageWindowExhaustedFromError, quotaExhaustedContent, quotaExhaustedFromError, userAttachmentRefusalFromError, } from './wireRefusalCopy.js';
8
9
  import { THROWN_SLOT_UNREADABLE, readErrorNumber, readThrownSlot, wireFailureTextsOf } from './wireFailureShape.js';
9
10
  import { effectiveCodeOf, ownReadingSlot, provablyNotSent, triageReadingOf } from './engineWireFor.js';
@@ -68,14 +69,7 @@ function isIdleWatchdog(err) {
68
69
  return false;
69
70
  }
70
71
  }
71
- const DETERMINISTIC_SERVER_CODES = new Set([
72
- CORRUPT_SESSION_ERROR_CODE,
73
- CORRUPT_ROW_ERROR_CODE,
74
- SCENARIO_ASSIGNMENT_UNKNOWN_ERROR_CODE,
75
- MEMORY_CONTROL_PLANE_CORRUPT,
76
- 'approvals.read_corrupt',
77
- 'workflow.journal_incompatible',
78
- ]);
72
+ const DETERMINISTIC_SERVER_CODES = new Set(SDK_NON_RETRYABLE_CODES);
79
73
  const BROWSER_FETCH_FAILURE = /\bfailed to fetch\b|\bnetworkerror\b|\bnetwork error\b|\bload failed\b/i;
80
74
  function httpShapeOf(verdict, code) {
81
75
  const status = verdict.status;
@@ -90,7 +84,7 @@ function httpShapeOf(verdict, code) {
90
84
  return { category: 'rate_limited', offer: false };
91
85
  if (code === 'budget.precall' || code === 'budget.exceeded')
92
86
  return { category: 'billing', offer: false };
93
- if (code === 'draining' || verdict.leaseUnavailable === true || isPreStreamDrainingReject(facts))
87
+ if (code === DRAINING_ERROR_CODE || verdict.leaseUnavailable === true || isPreStreamDrainingReject(facts))
94
88
  return { category: 'server_error', offer: true };
95
89
  if (status === 501 || (code !== undefined && code.startsWith('capability.')))
96
90
  return { category: 'capability_unavailable', offer: false };