@sema-agent/client-core 0.110.0 → 0.112.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.
Files changed (243) hide show
  1. package/CHANGELOG.md +244 -0
  2. package/README.md +59 -18
  3. package/dist/abortableSleep.d.ts +7 -0
  4. package/dist/abortableSleep.js +37 -0
  5. package/dist/adapt/arms.js +25 -4
  6. package/dist/adapt/toolCards.d.ts +3 -1
  7. package/dist/adapt/toolCards.js +4 -2
  8. package/dist/adapter/activeRunSelfHeal.d.ts +39 -0
  9. package/dist/adapter/activeRunSelfHeal.js +171 -3
  10. package/dist/adapter/downstream/eventToSdkMessage.js +10 -10
  11. package/dist/adapter/downstream/terminalToSdkResult.d.ts +2 -0
  12. package/dist/adapter/downstream/terminalToSdkResult.js +11 -0
  13. package/dist/adapter/runStream.d.ts +5 -0
  14. package/dist/adapter/runStream.js +15 -3
  15. package/dist/agentSession/engineSessionBackgroundStop.js +2 -2
  16. package/dist/attachmentRoute.d.ts +20 -0
  17. package/dist/attachmentRoute.js +39 -0
  18. package/dist/attachmentsWireCaps.js +1 -1
  19. package/dist/builtinOutputStyles.d.ts +12 -0
  20. package/dist/builtinOutputStyles.js +147 -0
  21. package/dist/checkpointRowVerdict.d.ts +3 -0
  22. package/dist/checkpointRowVerdict.js +14 -1
  23. package/dist/compactionStatus.d.ts +9 -0
  24. package/dist/compactionStatus.js +29 -5
  25. package/dist/consoleCaPin.d.ts +136 -0
  26. package/dist/consoleCaPin.js +827 -0
  27. package/dist/controlRouter.js +2 -1
  28. package/dist/coreValuePorts.d.ts +39 -1
  29. package/dist/coreValuePorts.js +10 -0
  30. package/dist/decideReceipt.d.ts +2 -1
  31. package/dist/deviceRebind.js +3 -3
  32. package/dist/displayUntrusted.d.ts +1 -0
  33. package/dist/displayUntrusted.js +6 -0
  34. package/dist/effectiveFacts.d.ts +9 -0
  35. package/dist/effectiveFacts.js +33 -0
  36. package/dist/engineAddress.d.ts +1 -0
  37. package/dist/engineAddress.js +4 -1
  38. package/dist/engineCredentialRelease.d.ts +54 -0
  39. package/dist/engineCredentialRelease.js +146 -0
  40. package/dist/engineErrorCodes.d.ts +1 -0
  41. package/dist/engineErrorCodes.js +1 -0
  42. package/dist/engineHealthProbeVerdict.d.ts +24 -0
  43. package/dist/engineHealthProbeVerdict.js +123 -0
  44. package/dist/engineNoticeCodes.js +5 -7
  45. package/dist/engineRepoint.d.ts +12 -5
  46. package/dist/engineRepoint.js +44 -19
  47. package/dist/engineRowRef.d.ts +3 -0
  48. package/dist/engineRowRef.js +11 -1
  49. package/dist/engineSwapCrossing.d.ts +57 -0
  50. package/dist/engineSwapCrossing.js +297 -0
  51. package/dist/engineUnavailable.d.ts +45 -0
  52. package/dist/engineUnavailable.js +496 -0
  53. package/dist/engineUrl.js +4 -2
  54. package/dist/eventLeg.js +3 -3
  55. package/dist/gateFailureCodes.js +2 -2
  56. package/dist/generated/sdkFactTables.d.ts +2 -1
  57. package/dist/generated/sdkFactTables.js +14 -0
  58. package/dist/generated/settingsSchemaFns.d.ts +1 -0
  59. package/dist/generated/settingsSchemaFns.js +3 -0
  60. package/dist/generated/settingsSchemaHooksClassifier.js +38 -9
  61. package/dist/generated/settingsSchemaTables.d.ts +56 -0
  62. package/dist/generated/settingsSchemaTables.js +19 -0
  63. package/dist/generated/settingsSchemaTypes.d.ts +23 -13
  64. package/dist/generated/settingsSchemaUrlShape.d.ts +1 -0
  65. package/dist/generated/settingsSchemaUrlShape.js +17 -0
  66. package/dist/hitl/approvalDelivery.d.ts +1 -0
  67. package/dist/hitl/approvalDelivery.js +1 -1
  68. package/dist/hitl/approvalResolution.d.ts +1 -1
  69. package/dist/hitl/approvalResolution.js +2 -1
  70. package/dist/hitl/askGateWire.js +5 -6
  71. package/dist/hitl/decisionRefusal.d.ts +6 -0
  72. package/dist/hitl/decisionRefusal.js +19 -10
  73. package/dist/hitl/decisionRefusalCarrier.d.ts +3 -0
  74. package/dist/hitl/decisionRefusalCarrier.js +348 -0
  75. package/dist/hitl/decisionSend.d.ts +7 -0
  76. package/dist/hitl/decisionSend.js +34 -12
  77. package/dist/hitl/editedApprovalAcceptance.js +1 -1
  78. package/dist/hitl/elicitationRefusal.d.ts +4 -0
  79. package/dist/hitl/elicitationRefusal.js +23 -0
  80. package/dist/hitl/frameRouter.d.ts +2 -2
  81. package/dist/hitl/frameRouter.js +8 -15
  82. package/dist/hitl/gateIdentity.d.ts +5 -0
  83. package/dist/hitl/gateIdentity.js +23 -0
  84. package/dist/hitl/hitlBridge.d.ts +6 -0
  85. package/dist/hitl/hitlBridge.js +10 -4
  86. package/dist/hitl/hitlHostSurface.d.ts +2 -1
  87. package/dist/hitl/hitlHostSurface.js +7 -2
  88. package/dist/hitl/localAllowRedemption.d.ts +70 -0
  89. package/dist/hitl/localAllowRedemption.js +276 -0
  90. package/dist/hitl/parkOwnership.js +2 -1
  91. package/dist/hitl/parkResolver.js +14 -4
  92. package/dist/hitl/persistedRulesWire.d.ts +16 -0
  93. package/dist/hitl/persistedRulesWire.js +70 -0
  94. package/dist/hitl/planReviewWire.d.ts +3 -0
  95. package/dist/hitl/planReviewWire.js +23 -6
  96. package/dist/hitl/policyDenyCause.d.ts +1 -1
  97. package/dist/hitl/policyDenyCause.js +1 -1
  98. package/dist/hitl/resumeRunningCard.d.ts +1 -0
  99. package/dist/hitl/resumeRunningCard.js +1 -0
  100. package/dist/hitl/screenCardCarriers.d.ts +15 -0
  101. package/dist/hitl/screenCardCarriers.js +41 -0
  102. package/dist/hitl/screenDecisionCards.d.ts +98 -0
  103. package/dist/hitl/screenDecisionCards.js +363 -0
  104. package/dist/hitl/sessionPolicyWire.js +2 -2
  105. package/dist/hitl/standingRows.d.ts +6 -2
  106. package/dist/hitl/standingRows.js +27 -2
  107. package/dist/hitl/toolApprovalWire.d.ts +30 -8
  108. package/dist/hitl/toolApprovalWire.js +264 -121
  109. package/dist/hooksReaderGenerations.js +1 -1
  110. package/dist/hooksWireCaps.js +3 -3
  111. package/dist/hostSettingNoticeArm.d.ts +3 -0
  112. package/dist/hostSettingNoticeArm.js +12 -0
  113. package/dist/hostTurnSettings.d.ts +3 -0
  114. package/dist/hostTurnSettings.js +38 -5
  115. package/dist/humanTurnRead.js +11 -1
  116. package/dist/i18n/messages.en.d.ts +292 -0
  117. package/dist/i18n/messages.en.js +298 -7
  118. package/dist/i18n/messages.zh.js +316 -6
  119. package/dist/i18n/translate.d.ts +3 -0
  120. package/dist/i18n/translate.js +78 -10
  121. package/dist/i18n/zh.d.ts +1 -0
  122. package/dist/i18n/zh.js +1 -0
  123. package/dist/index.d.ts +71 -20
  124. package/dist/index.js +44 -13
  125. package/dist/interactiveHalt.js +2 -1
  126. package/dist/interactiveInterrupt.js +20 -2
  127. package/dist/liveModelCatalog.d.ts +4 -0
  128. package/dist/liveModelCatalog.js +12 -3
  129. package/dist/localConfig/documents.d.ts +61 -0
  130. package/dist/localConfig/documents.js +51 -0
  131. package/dist/localConfig/kernel.d.ts +149 -0
  132. package/dist/localConfig/kernel.js +597 -0
  133. package/dist/localConfig/mcp/edit.d.ts +161 -0
  134. package/dist/localConfig/mcp/edit.js +846 -0
  135. package/dist/localConfig/mcp/servers.d.ts +165 -0
  136. package/dist/localConfig/mcp/servers.js +776 -0
  137. package/dist/localConfig/mcp/views.d.ts +170 -0
  138. package/dist/localConfig/mcp/views.js +429 -0
  139. package/dist/localConfig/modelPool.d.ts +262 -0
  140. package/dist/localConfig/modelPool.js +1489 -0
  141. package/dist/localConfig/modelPoolWords.d.ts +13 -0
  142. package/dist/localConfig/modelPoolWords.js +20 -0
  143. package/dist/localConfig/receiptShape.d.ts +7 -0
  144. package/dist/localConfig/receiptShape.js +135 -0
  145. package/dist/localConfig/settingsWrite.d.ts +127 -0
  146. package/dist/localConfig/settingsWrite.js +237 -0
  147. package/dist/localConfig/skills.d.ts +124 -0
  148. package/dist/localConfig/skills.js +397 -0
  149. package/dist/localConfig/skillsWords.d.ts +10 -0
  150. package/dist/localConfig/skillsWords.js +5 -0
  151. package/dist/localEngineSeatReading.d.ts +2 -2
  152. package/dist/localEngineSeatReading.js +5 -3
  153. package/dist/localEngineSpawn.d.ts +0 -7
  154. package/dist/localEngineSpawn.js +0 -92
  155. package/dist/localEngineStep.d.ts +2 -2
  156. package/dist/localEngineStep.js +2 -0
  157. package/dist/mcpProbeWire.js +2 -1
  158. package/dist/mcpReconnect.js +3 -3
  159. package/dist/mcpWireCaps.js +1 -1
  160. package/dist/memoryVerbsWire.js +3 -2
  161. package/dist/model/engineModelWords.d.ts +3 -0
  162. package/dist/model/engineModelWords.js +13 -0
  163. package/dist/model/onboardJudgement.d.ts +14 -4
  164. package/dist/model/onboardJudgement.js +91 -139
  165. package/dist/model/subagentModelWord.d.ts +21 -2
  166. package/dist/model/subagentModelWord.js +100 -29
  167. package/dist/modelCapabilityProbe.js +3 -40
  168. package/dist/modelConfigGapNotice.d.ts +20 -0
  169. package/dist/modelConfigGapNotice.js +102 -0
  170. package/dist/modsKernelIdentity.js +2 -47
  171. package/dist/notifications.d.ts +19 -0
  172. package/dist/notifications.js +114 -12
  173. package/dist/ownKey.d.ts +7 -0
  174. package/dist/ownKey.js +71 -8
  175. package/dist/pendingUserRow.d.ts +4 -0
  176. package/dist/pendingUserRow.js +16 -0
  177. package/dist/permissionsDeclaration.d.ts +3 -1
  178. package/dist/permissionsDeclaration.js +33 -9
  179. package/dist/planReviewCardFacts.d.ts +3 -0
  180. package/dist/planReviewCardFacts.js +52 -2
  181. package/dist/pluginHooksWire.d.ts +9 -1
  182. package/dist/pluginHooksWire.js +40 -6
  183. package/dist/printToolResultFrame.js +4 -2
  184. package/dist/promptBlockedCopy.js +12 -7
  185. package/dist/promptSuggestionBatch.d.ts +7 -0
  186. package/dist/promptSuggestionBatch.js +9 -0
  187. package/dist/promptSuggestionsTail.d.ts +39 -0
  188. package/dist/promptSuggestionsTail.js +116 -0
  189. package/dist/request/taskRequest.js +10 -6
  190. package/dist/requestCoordinate.d.ts +1 -0
  191. package/dist/requestCoordinate.js +13 -0
  192. package/dist/resumeRefusalCopy.d.ts +3 -1
  193. package/dist/resumeRefusalCopy.js +12 -4
  194. package/dist/rewindArchiveReading.js +4 -4
  195. package/dist/runCancelContext.d.ts +2 -1
  196. package/dist/runCancelContext.js +1 -0
  197. package/dist/runLedgerSnapshot.js +3 -3
  198. package/dist/runPermissionModeSwitch.js +3 -4
  199. package/dist/scenarioRefusal.js +11 -13
  200. package/dist/scenarioSkills.js +11 -6
  201. package/dist/seam.d.ts +16 -2
  202. package/dist/seam.js +10 -0
  203. package/dist/seatContract.d.ts +259 -9
  204. package/dist/seatContract.js +444 -15
  205. package/dist/sessionCostReading.d.ts +70 -0
  206. package/dist/sessionCostReading.js +150 -0
  207. package/dist/sessionHooksRoster.d.ts +4 -0
  208. package/dist/sessionHooksRoster.js +158 -0
  209. package/dist/sessionIdSegment.d.ts +1 -0
  210. package/dist/sessionIdSegment.js +4 -1
  211. package/dist/sessionMemoryErase.js +2 -1
  212. package/dist/sessionMemoryStatus.js +2 -2
  213. package/dist/sessionReadRedaction.d.ts +7 -0
  214. package/dist/sessionReadRedaction.js +26 -0
  215. package/dist/sessionSyncFileHistory.js +8 -9
  216. package/dist/settingsHooksSalvage.js +2 -1
  217. package/dist/sha256Bytes.d.ts +1 -0
  218. package/dist/sha256Bytes.js +46 -0
  219. package/dist/skillOverrideChain.d.ts +83 -0
  220. package/dist/skillOverrideChain.js +378 -0
  221. package/dist/skillsWireCaps.d.ts +3 -0
  222. package/dist/skillsWireCaps.js +16 -1
  223. package/dist/sseIdleTriage.js +2 -1
  224. package/dist/storeDurabilityWord.d.ts +15 -0
  225. package/dist/storeDurabilityWord.js +18 -0
  226. package/dist/storePostureCapability.d.ts +7 -3
  227. package/dist/storePostureCapability.js +69 -39
  228. package/dist/subagent/engineSubagentResume.js +2 -2
  229. package/dist/subagent/engineSubagentTail.js +2 -1
  230. package/dist/subagentContentStore.d.ts +11 -0
  231. package/dist/subagentContentStore.js +28 -2
  232. package/dist/toolResult.d.ts +1 -0
  233. package/dist/toolResult.js +2 -0
  234. package/dist/turnFailurePresentation.js +4 -10
  235. package/dist/userAttachmentEnvelope.d.ts +2 -1
  236. package/dist/userAttachmentEnvelope.js +10 -0
  237. package/dist/wireErrorTriage.js +2 -1
  238. package/dist/wireFailureShape.d.ts +4 -0
  239. package/dist/wireFailureShape.js +141 -19
  240. package/dist/wireRefusalCopy.d.ts +6 -5
  241. package/dist/wireRefusalCopy.js +49 -92
  242. package/docs/INTEGRATION-CLIENTS.md +2718 -17
  243. package/package.json +7 -3
@@ -0,0 +1,20 @@
1
+ import type { UiLanguage } from './env/uiLanguage.js';
2
+ type ModelConfigPartTuple = readonly ['model', 'gateway-url', 'api-key'];
3
+ export type ModelConfigPart = ModelConfigPartTuple[number];
4
+ export type ModelConfigKeyChannel = 'anthropic';
5
+ export interface ModelConfigGap {
6
+ readonly parts: readonly ModelConfigPart[];
7
+ readonly keyChannel?: ModelConfigKeyChannel;
8
+ readonly catalogEntries?: number;
9
+ }
10
+ export type ModelConfigGapNotice = {
11
+ readonly kind: 'gap';
12
+ readonly head: string;
13
+ readonly detail: string;
14
+ } | {
15
+ readonly kind: 'none';
16
+ } | {
17
+ readonly kind: 'malformed';
18
+ };
19
+ export declare function modelConfigGapNotice(missing: ModelConfigGap, lang?: UiLanguage): ModelConfigGapNotice;
20
+ export {};
@@ -0,0 +1,102 @@
1
+ import { msg, renderMessage } from './i18n/translate.js';
2
+ import { guardedRead, ownDataField } from './ownKey.js';
3
+ function partOrder() {
4
+ return ['model', 'gateway-url', 'api-key'];
5
+ }
6
+ function isPart(v) {
7
+ return v === 'model' || v === 'gateway-url' || v === 'api-key';
8
+ }
9
+ const MALFORMED = Object.freeze({ kind: 'malformed' });
10
+ const NONE = Object.freeze({ kind: 'none' });
11
+ function readGap(missing) {
12
+ try {
13
+ if (missing === null || typeof missing !== 'object' || Array.isArray(missing))
14
+ return undefined;
15
+ const raw = ownDataField(missing, 'parts');
16
+ if (!Array.isArray(raw))
17
+ return undefined;
18
+ const order = partOrder();
19
+ const length = ownDataField(raw, 'length');
20
+ if (typeof length !== 'number' || !Number.isSafeInteger(length) || length < 0 || length > order.length)
21
+ return undefined;
22
+ const present = new Set();
23
+ for (let i = 0; i < length; i++) {
24
+ const word = ownDataField(raw, String(i));
25
+ if (!isPart(word) || present.has(word))
26
+ return undefined;
27
+ present.add(word);
28
+ }
29
+ const parts = order.filter((p) => present.has(p));
30
+ const channel = guardedRead(() => ownDataField(missing, 'keyChannel'));
31
+ const count = guardedRead(() => ownDataField(missing, 'catalogEntries'));
32
+ return {
33
+ parts,
34
+ anthropicKey: channel === 'anthropic' && present.has('api-key'),
35
+ entries: typeof count === 'number' && Number.isSafeInteger(count) && count >= 1 ? count : undefined,
36
+ };
37
+ }
38
+ catch {
39
+ return undefined;
40
+ }
41
+ }
42
+ const HEAD_KEYS = Object.freeze({
43
+ model: 'model.configGap.head.model',
44
+ gatewayUrl: 'model.configGap.head.gatewayUrl',
45
+ apiKey: 'model.configGap.head.apiKey',
46
+ anthropicKey: 'model.configGap.head.anthropicKey',
47
+ incomplete: 'model.configGap.head.incomplete',
48
+ });
49
+ function headKeyOf(r) {
50
+ if (r.parts.includes('model'))
51
+ return HEAD_KEYS.model;
52
+ if (r.parts.includes('gateway-url'))
53
+ return r.parts.includes('api-key') ? HEAD_KEYS.incomplete : HEAD_KEYS.gatewayUrl;
54
+ return r.anthropicKey ? HEAD_KEYS.anthropicKey : HEAD_KEYS.apiKey;
55
+ }
56
+ function itemRef(part, anthropicKey) {
57
+ switch (part) {
58
+ case 'model':
59
+ return msg('model.configGap.item.model');
60
+ case 'gateway-url':
61
+ return msg('model.configGap.item.gatewayUrl');
62
+ case 'api-key':
63
+ return msg(anthropicKey ? 'model.configGap.item.anthropicKey' : 'model.configGap.item.apiKey');
64
+ }
65
+ }
66
+ function leadRef(first, second, third, anthropicKey) {
67
+ const a = itemRef(first, anthropicKey);
68
+ if (second === undefined)
69
+ return msg('model.configGap.lead.one', { a });
70
+ const b = itemRef(second, anthropicKey);
71
+ if (third === undefined)
72
+ return msg('model.configGap.lead.two', { a, b });
73
+ return msg('model.configGap.lead.three', { a, b, c: itemRef(third, anthropicKey) });
74
+ }
75
+ function reasonRef(r) {
76
+ if (r.parts.includes('model'))
77
+ return msg('model.configGap.reason.noModel');
78
+ const n = r.entries;
79
+ if (n === undefined)
80
+ return undefined;
81
+ if (r.anthropicKey)
82
+ return n === 1 ? msg('model.configGap.reason.anthropicCatalog.one') : msg('model.configGap.reason.anthropicCatalog.other', { count: n });
83
+ if (r.parts.includes('gateway-url'))
84
+ return n === 1 ? msg('model.configGap.reason.gatewayCatalog.one') : msg('model.configGap.reason.gatewayCatalog.other', { count: n });
85
+ return undefined;
86
+ }
87
+ export function modelConfigGapNotice(missing, lang) {
88
+ const r = readGap(missing);
89
+ if (r === undefined)
90
+ return MALFORMED;
91
+ const [first, second, third] = r.parts;
92
+ if (first === undefined)
93
+ return NONE;
94
+ const lead = leadRef(first, second, third, r.anthropicKey);
95
+ const reason = reasonRef(r);
96
+ const detail = reason === undefined ? lead : msg('model.configGap.detail.withReason', { missing: lead, reason });
97
+ return Object.freeze({
98
+ kind: 'gap',
99
+ head: renderMessage(msg(headKeyOf(r)), lang),
100
+ detail: renderMessage(detail, lang),
101
+ });
102
+ }
@@ -1,4 +1,5 @@
1
1
  import { KERNEL_CONTRACT_VERSION, MOD_EVENT_TABLE } from '@sema-agent/mods-kernel';
2
+ import { sha256BytesHex } from './sha256Bytes.js';
2
3
  const MAX_DEPTH = 16;
3
4
  const MAX_NODES = 100_000;
4
5
  function canonical(v, depth, budget) {
@@ -35,52 +36,6 @@ function canonical(v, depth, budget) {
35
36
  }
36
37
  throw new TypeError('modsKernelIdentity: the event table holds a value that is not plain data');
37
38
  }
38
- function sha256Hex(msg) {
39
- const k = [
40
- 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,
41
- 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,
42
- 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,
43
- 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2,
44
- ];
45
- const h = [0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19];
46
- const len = msg.length;
47
- const padded = new Uint8Array(((len + 8) >>> 6) * 64 + 64);
48
- padded.set(msg);
49
- padded[len] = 0x80;
50
- const view = new DataView(padded.buffer);
51
- view.setUint32(padded.length - 8, Math.floor(len / 0x20000000));
52
- view.setUint32(padded.length - 4, (len << 3) >>> 0);
53
- const w = new Array(64).fill(0);
54
- const rotr = (x, n) => (x >>> n) | (x << (32 - n));
55
- for (let off = 0; off < padded.length; off += 64) {
56
- for (let t = 0; t < 16; t++)
57
- w[t] = view.getUint32(off + t * 4);
58
- for (let t = 16; t < 64; t++) {
59
- const x = w[t - 15] ?? 0;
60
- const y = w[t - 2] ?? 0;
61
- const s0 = rotr(x, 7) ^ rotr(x, 18) ^ (x >>> 3);
62
- const s1 = rotr(y, 17) ^ rotr(y, 19) ^ (y >>> 10);
63
- w[t] = ((w[t - 16] ?? 0) + s0 + (w[t - 7] ?? 0) + s1) | 0;
64
- }
65
- let [a, b, c, d, e, f, g, hh] = h;
66
- for (let t = 0; t < 64; t++) {
67
- const t1 = (hh + (rotr(e, 6) ^ rotr(e, 11) ^ rotr(e, 25)) + ((e & f) ^ (~e & g)) + (k[t] ?? 0) + (w[t] ?? 0)) | 0;
68
- const t2 = ((rotr(a, 2) ^ rotr(a, 13) ^ rotr(a, 22)) + ((a & b) ^ (a & c) ^ (b & c))) | 0;
69
- hh = g;
70
- g = f;
71
- f = e;
72
- e = (d + t1) | 0;
73
- d = c;
74
- c = b;
75
- b = a;
76
- a = (t1 + t2) | 0;
77
- }
78
- const next = [a, b, c, d, e, f, g, hh];
79
- for (let i = 0; i < 8; i++)
80
- h[i] = ((h[i] ?? 0) + (next[i] ?? 0)) | 0;
81
- }
82
- return h.map((x) => (x >>> 0).toString(16).padStart(8, '0')).join('');
83
- }
84
39
  export function modsKernelIdentity(kernel = { KERNEL_CONTRACT_VERSION, MOD_EVENT_TABLE }) {
85
40
  try {
86
41
  if (typeof kernel !== 'object' || kernel === null)
@@ -93,7 +48,7 @@ export function modsKernelIdentity(kernel = { KERNEL_CONTRACT_VERSION, MOD_EVENT
93
48
  if (typeof table !== 'object' || table === null || Array.isArray(table)) {
94
49
  throw new TypeError('modsKernelIdentity: the source carries no readable event table');
95
50
  }
96
- return { contractVersion, tableDigest: sha256Hex(new TextEncoder().encode(canonical(table, 0, { nodes: 0 }))) };
51
+ return { contractVersion, tableDigest: sha256BytesHex(new TextEncoder().encode(canonical(table, 0, { nodes: 0 }))) };
97
52
  }
98
53
  catch (e) {
99
54
  if (e instanceof TypeError)
@@ -1,4 +1,5 @@
1
1
  import type { PlanReviewOutcomeMeta } from './hitl/planReviewWire.js';
2
+ import type { UiLanguage } from './env/uiLanguage.js';
2
3
  import type { SubmissionKind } from './request/submissionIdentity.js';
3
4
  export interface TaskNotificationFields {
4
5
  taskId: string;
@@ -87,6 +88,19 @@ export declare function installNotificationQueuePort(port: NotificationQueuePort
87
88
  export declare function notificationQueuePortMisses(): number;
88
89
  export declare function _resetNotificationQueuePortForTest(): void;
89
90
  export declare function enqueuePlanReviewOutcome(value: string, meta?: PlanReviewOutcomeMeta): boolean;
91
+ export type ResupplyTruncatedSource = 'task_notification' | 'workflow_complete';
92
+ export declare function resupplyTruncatedSentence(facts: {
93
+ readonly bytes: number;
94
+ readonly droppedKeys: readonly string[];
95
+ } | null | undefined, lang?: UiLanguage): string | undefined;
96
+ export interface ResupplyTruncatedArmBody {
97
+ readonly source: ResupplyTruncatedSource;
98
+ readonly taskId: string;
99
+ readonly bytes: number;
100
+ readonly droppedKeys: readonly string[];
101
+ readonly text: string;
102
+ }
103
+ export declare function resupplyTruncatedArmBody(carrier: object | null | undefined, source: ResupplyTruncatedSource, taskId: string): ResupplyTruncatedArmBody | undefined;
90
104
  export declare function dropQueuedNotificationsForRun(taskId: string): number;
91
105
  export declare function markEngineWorkflowNotified(runId: string): void;
92
106
  export declare function isEngineWorkflowNotified(runId: string): boolean;
@@ -104,6 +118,7 @@ export type WorkflowRunTerminalReading = {
104
118
  readonly result?: string;
105
119
  readonly error?: string;
106
120
  readonly pointer: 'absent';
121
+ readonly truncated?: true;
107
122
  } | {
108
123
  readonly state: 'unknown';
109
124
  readonly why: 'body_unreadable' | 'status_unreadable' | 'status_unrecognized';
@@ -140,6 +155,7 @@ export interface EngineWorkflowCompletion {
140
155
  status: 'completed' | 'failed';
141
156
  summary: string;
142
157
  completionId?: string;
158
+ diagnostics?: string;
143
159
  }
144
160
  export declare function enqueueBgChildNotification(raw: {
145
161
  taskId: string;
@@ -149,6 +165,9 @@ export declare function enqueueBgChildNotification(raw: {
149
165
  completionId?: string;
150
166
  }): void;
151
167
  export declare function enqueueEngineWorkflowNotification(raw: EngineWorkflowCompletion): void;
168
+ export declare function workflowRecordRefOf(diagnostics: string | undefined): string | undefined;
169
+ export declare function takeWorkflowPointerSupplement(runId: string, status: string, diagnostics: string | undefined, completionId?: string): Readonly<TaskNotificationFields> | undefined;
170
+ export declare function settleWorkflowPointerOwed(runId: string): void;
152
171
  export declare function _resetEngineTaskNotificationForTest(): void;
153
172
  export declare function _tickWatchOnceForTest(nowMs?: number): Promise<void>;
154
173
  export declare function _setWatcherTimingForTest(o: {
@@ -5,8 +5,9 @@ import { panelEndFact } from './panelReduce.js';
5
5
  import { isCoreTaskNotificationTerminal, isCoreTaskNotificationTerminalNotSuccess, isCoreWorkflowRunParkedEnd, isCoreWorkflowRunTerminal } from './terminalStatuses.js';
6
6
  import { cycleSeqValue } from './cycleOrder.js';
7
7
  import { CORE_ENGINE_AUTHORITY_ENVELOPE_TAGS } from './generated/engineFactTables.js';
8
- import { guardedRead, ownSnapshot, ownSnapshotRecord, ownSnapshotTyped, readOwnDataValue, workflowCompletionExtrasOf } from './ownKey.js';
9
- import { displayUntrusted } from './displayUntrusted.js';
8
+ import { guardedRead, ownSnapshot, ownSnapshotRecord, ownSnapshotTyped, readOwnDataNonEmptyString, readOwnDataValue, resupplyTruncatedFactsOf, resupplyTruncatedOf, workflowCompletionExtrasOf } from './ownKey.js';
9
+ import { msg, renderMessage } from './i18n/translate.js';
10
+ import { displayUntrustedCapped } from './displayUntrusted.js';
10
11
  function escapeXml(v) {
11
12
  return v.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
12
13
  }
@@ -213,6 +214,7 @@ export function normalizeTaskNotification(raw) {
213
214
  ? n.lines.filter((l) => typeof l === 'string')
214
215
  : [];
215
216
  const recentSteps = deriveNotificationResidualLines(n);
217
+ const failureReason = failureReasonOf(status, n.error);
216
218
  return {
217
219
  taskId,
218
220
  status,
@@ -230,6 +232,7 @@ export function normalizeTaskNotification(raw) {
230
232
  ? { diagnostics: n.diagnostics }
231
233
  : {}),
232
234
  ...(typeof n.result === 'string' && n.result.length > 0 ? { result: n.result } : {}),
235
+ ...(failureReason !== undefined ? { error: failureReason } : {}),
233
236
  ...(typeof n.stoppedBy === 'string' && n.stoppedBy.length > 0 ? { stoppedBy: n.stoppedBy } : {}),
234
237
  ...(n.partial === true ? { partial: true } : {}),
235
238
  ...(typeof n.exitCode === 'number' ? { exitCode: n.exitCode } : {}),
@@ -422,6 +425,7 @@ export function enqueuePlanReviewOutcome(value, meta) {
422
425
  queuePortMisses++;
423
426
  return false;
424
427
  }
428
+ const questionId = meta === undefined ? undefined : guardedRead(() => readOwnDataNonEmptyString(meta, 'questionId'));
425
429
  p.enqueueMetaPrompt({
426
430
  value,
427
431
  mode: 'prompt',
@@ -436,12 +440,34 @@ export function enqueuePlanReviewOutcome(value, meta) {
436
440
  decision: meta.decision,
437
441
  effect: meta.effect,
438
442
  ...(meta.effect === 'still_parked' && meta.cause === 'stored_form_unsupported' ? { cause: meta.cause } : {}),
443
+ ...(questionId !== undefined ? { questionId } : {}),
439
444
  }),
440
445
  }
441
446
  : {}),
442
447
  });
443
448
  return true;
444
449
  }
450
+ export function resupplyTruncatedSentence(facts, lang) {
451
+ try {
452
+ const f = resupplyTruncatedFactsOf(facts);
453
+ if (f === undefined)
454
+ return undefined;
455
+ const count = f.droppedKeys.length;
456
+ return renderMessage(msg(count === 1 ? 'notice.resupply.truncated.one' : 'notice.resupply.truncated.other', count === 1 ? { bytes: f.bytes } : { bytes: f.bytes, count }), lang);
457
+ }
458
+ catch {
459
+ return undefined;
460
+ }
461
+ }
462
+ export function resupplyTruncatedArmBody(carrier, source, taskId) {
463
+ const facts = resupplyTruncatedOf(carrier);
464
+ if (facts === undefined)
465
+ return undefined;
466
+ const text = resupplyTruncatedSentence(facts);
467
+ if (text === undefined)
468
+ return undefined;
469
+ return { source, taskId, bytes: facts.bytes, droppedKeys: facts.droppedKeys, text };
470
+ }
445
471
  export function dropQueuedNotificationsForRun(taskId) {
446
472
  const needle = `<${TASK_ID_TAG}>${escapeXml(taskId)}</${TASK_ID_TAG}>`;
447
473
  const p = port();
@@ -494,20 +520,25 @@ export function workflowRunTerminalReadingOf(body) {
494
520
  if (isCoreWorkflowRunParkedEnd(status, guardedRead(() => readOwnDataValue(snap, 'errorCode'))))
495
521
  return Object.freeze({ state: 'awaiting approval' });
496
522
  const result = guardedRead(() => readOwnDataValue(snap, 'result'));
497
- const error = status === 'failed' ? guardedRead(() => readOwnDataValue(snap, 'error')) : undefined;
498
- const shownError = typeof error === 'string' && error.length > 0 ? shownRunError(error) : '';
523
+ const shownError = failureReasonOf(status, guardedRead(() => readOwnDataValue(snap, 'error')));
524
+ const resultFull = guardedRead(() => readOwnDataValue(snap, 'resultFull'));
499
525
  return Object.freeze({
500
526
  state: status,
501
527
  ...(typeof result === 'string' && result.length > 0 ? { result } : {}),
502
- ...(shownError.length > 0 ? { error: shownError } : {}),
528
+ ...(shownError !== undefined ? { error: shownError } : {}),
503
529
  pointer: 'absent',
530
+ ...(typeof resultFull === 'string' && resultFull.length > 0 ? { truncated: true } : {}),
504
531
  });
505
532
  }
506
533
  const WORKFLOW_RUN_ERROR_MAX = 200;
507
534
  function shownRunError(raw) {
508
- const opts = { foldLines: false, escapeBackslashes: 'auto' };
509
- const whole = displayUntrusted(raw, opts);
510
- return whole.length <= WORKFLOW_RUN_ERROR_MAX ? whole : `${displayUntrusted(raw, { ...opts, max: WORKFLOW_RUN_ERROR_MAX - 1 })}…`;
535
+ return displayUntrustedCapped(raw, WORKFLOW_RUN_ERROR_MAX, { foldLines: false, escapeBackslashes: 'auto' });
536
+ }
537
+ function failureReasonOf(status, raw) {
538
+ if (status !== 'failed' || typeof raw !== 'string' || raw.length === 0)
539
+ return undefined;
540
+ const shown = shownRunError(raw);
541
+ return shown.length > 0 ? shown : undefined;
511
542
  }
512
543
  function workflowPollDecisionOf(delivered, reading) {
513
544
  if (delivered)
@@ -518,7 +549,13 @@ function workflowPollDecisionOf(delivered, reading) {
518
549
  return { act: 'wait', why: 'awaiting approval' };
519
550
  if (reading.state === 'unknown')
520
551
  return { act: 'wait', why: 'unknown' };
521
- return { act: 'emit', status: reading.state, ...(reading.result !== undefined ? { result: reading.result } : {}), ...(reading.error !== undefined ? { error: reading.error } : {}) };
552
+ return {
553
+ act: 'emit',
554
+ status: reading.state,
555
+ ...(reading.result !== undefined ? { result: reading.result } : {}),
556
+ ...(reading.error !== undefined ? { error: reading.error } : {}),
557
+ ...(reading.truncated === true ? { truncated: true } : {}),
558
+ };
522
559
  }
523
560
  function workflowPollCompletionSummary(status, error) {
524
561
  const head = `workflow ${status} (read from its run record; no handle to the full record is available)`;
@@ -826,7 +863,7 @@ async function tickWatchInner(now) {
826
863
  if (outstandingRuns.delete(runId))
827
864
  notifyOutstanding();
828
865
  if (decision.act === 'emit') {
829
- enqueueWorkflowCompletion({ runId, status: decision.status, summary: workflowPollCompletionSummary(decision.status, decision.error) }, { ...(decision.result !== undefined ? { result: decision.result } : {}), ...(decision.error !== undefined ? { error: decision.error } : {}) });
866
+ enqueueWorkflowCompletion({ runId, status: decision.status, summary: workflowPollCompletionSummary(decision.status, decision.error) }, { ...(decision.result !== undefined ? { result: decision.result } : {}), ...(decision.error !== undefined ? { error: decision.error } : {}) }, { truncated: decision.truncated === true });
830
867
  }
831
868
  }
832
869
  catch {
@@ -890,9 +927,17 @@ export function enqueueEngineWorkflowNotification(raw) {
890
927
  traceNotif('workflow-notification dropped:payload-unreadable');
891
928
  return;
892
929
  }
893
- enqueueWorkflowCompletion(c, completionIdOnly(workflowCompletionExtrasOf(c)));
930
+ const extras = workflowCompletionExtrasOf(c);
931
+ if (notifiedRunIds.has(c.runId)) {
932
+ const supplement = takeWorkflowPointerSupplement(c.runId, c.status, extras.diagnostics, extras.completionId);
933
+ if (supplement !== undefined) {
934
+ port()?.enqueuePendingNotification(taskNotificationQueueCommand(supplement));
935
+ return;
936
+ }
937
+ }
938
+ enqueueWorkflowCompletion(c, completionIdOnly(extras));
894
939
  }
895
- function enqueueWorkflowCompletion(c, body) {
940
+ function enqueueWorkflowCompletion(c, body, poll) {
896
941
  if (notifiedRunIds.has(c.runId)) {
897
942
  workflowDedupDropped++;
898
943
  traceNotif(`workflow notification suppressed (run already notified) runId=${c.runId} status=${c.status}`);
@@ -900,11 +945,68 @@ function enqueueWorkflowCompletion(c, body) {
900
945
  }
901
946
  markRunNotified(c.runId);
902
947
  cardEnqueuedRunIds.add(c.runId);
948
+ if (poll !== undefined)
949
+ notePointerOwed(c.runId, poll.truncated);
903
950
  port()?.enqueuePendingNotification(taskNotificationQueueCommand({ taskId: c.runId, taskType: 'workflow', status: c.status, summary: c.summary, ...body }));
904
951
  }
952
+ const pointerOwedRuns = new Map();
953
+ const POINTER_OWED_MAX = 512;
954
+ function notePointerOwed(runId, truncated) {
955
+ pointerOwedRuns.delete(runId);
956
+ pointerOwedRuns.set(runId, { truncated });
957
+ while (pointerOwedRuns.size > POINTER_OWED_MAX) {
958
+ const oldest = pointerOwedRuns.keys().next();
959
+ if (oldest.done === true)
960
+ break;
961
+ pointerOwedRuns.delete(oldest.value);
962
+ }
963
+ }
964
+ const WORKFLOW_RECORD_REF_SENTENCE = /Full record \(the result and every agent's row\): read it with ReadToolResult \(ref "([A-Za-z0-9_.~-]{1,518})"\) before assuming an empty or unexpected result\./g;
965
+ export function workflowRecordRefOf(diagnostics) {
966
+ if (typeof diagnostics !== 'string' || diagnostics.length === 0)
967
+ return undefined;
968
+ try {
969
+ let ref;
970
+ for (const m of diagnostics.matchAll(WORKFLOW_RECORD_REF_SENTENCE))
971
+ ref = m[1];
972
+ return ref;
973
+ }
974
+ catch {
975
+ return undefined;
976
+ }
977
+ }
978
+ function workflowPointerSupplementSummary(ref, truncated) {
979
+ const head = `Full record of this workflow run (the result and every agent's row): read it with ReadToolResult (ref "${ref}")`;
980
+ return truncated ? `${head} — the result delivered earlier was cut short; the full text is in this record.` : `${head}.`;
981
+ }
982
+ export function takeWorkflowPointerSupplement(runId, status, diagnostics, completionId) {
983
+ try {
984
+ const owed = pointerOwedRuns.get(runId);
985
+ if (owed === undefined)
986
+ return undefined;
987
+ const ref = workflowRecordRefOf(diagnostics);
988
+ if (ref === undefined)
989
+ return undefined;
990
+ pointerOwedRuns.delete(runId);
991
+ return freezeTaskNotificationFields({
992
+ taskId: runId,
993
+ taskType: 'workflow',
994
+ status,
995
+ summary: workflowPointerSupplementSummary(ref, owed.truncated),
996
+ ...(completionId !== undefined ? { completionId } : {}),
997
+ });
998
+ }
999
+ catch {
1000
+ return undefined;
1001
+ }
1002
+ }
1003
+ export function settleWorkflowPointerOwed(runId) {
1004
+ pointerOwedRuns.delete(runId);
1005
+ }
905
1006
  export function _resetEngineTaskNotificationForTest() {
906
1007
  notifiedRunIds.clear();
907
1008
  notifiedBgCycleHigh.clear();
1009
+ pointerOwedRuns.clear();
908
1010
  cardEnqueuedRunIds.clear();
909
1011
  outstandingRuns.clear();
910
1012
  outstandingBgTasks.clear();
package/dist/ownKey.d.ts CHANGED
@@ -75,7 +75,14 @@ export interface SampledRecord {
75
75
  export declare function ownSnapshotWhenTyped<V>(value: V, word: string): SampledJson;
76
76
  export declare function ownSnapshotTyped<T extends object>(value: T): T | undefined;
77
77
  export declare function ownSnapshotRecord<V>(value: V): SampledRecord | undefined;
78
+ export declare function ownSnapshotRecordFaithful<V>(value: V): SampledRecord | undefined;
78
79
  export declare function workflowCompletionExtrasOf(c: object): {
79
80
  completionId?: string;
80
81
  diagnostics?: string;
81
82
  };
83
+ export interface ResupplyTruncatedFacts {
84
+ readonly bytes: number;
85
+ readonly droppedKeys: readonly string[];
86
+ }
87
+ export declare function resupplyTruncatedFactsOf(slot: {} | null | undefined): ResupplyTruncatedFacts | undefined;
88
+ export declare function resupplyTruncatedOf(carrier: object | null | undefined): ResupplyTruncatedFacts | undefined;
package/dist/ownKey.js CHANGED
@@ -291,6 +291,7 @@ export function promptManifestIdentityOf(raw) {
291
291
  }
292
292
  }
293
293
  const SAMPLED = new WeakSet();
294
+ const LOSSY = new WeakSet();
294
295
  const SAMPLE_MAX_DEPTH = 256;
295
296
  export function isOwnSnapshot(v) {
296
297
  return isBranded(v);
@@ -311,7 +312,7 @@ function snapshotOf(value) {
311
312
  if (typeof value === 'object' && value !== null) {
312
313
  if (SAMPLED.has(value))
313
314
  return value;
314
- return sampleObject(value, 0, { done: new Map(), path: new Set(), seen: new Set(), rework: 0, depthCuts: 0 });
315
+ return sampleObject(value, 0, { done: new Map(), path: new Set(), seen: new Set(), rework: 0, depthCuts: 0, lost: 0 });
315
316
  }
316
317
  return samplePrimitive(value);
317
318
  }
@@ -342,6 +343,10 @@ export function ownSnapshotTyped(value) {
342
343
  export function ownSnapshotRecord(value) {
343
344
  return recordOf(value);
344
345
  }
346
+ export function ownSnapshotRecordFaithful(value) {
347
+ const s = recordOf(value);
348
+ return s === undefined || LOSSY.has(s) ? undefined : s;
349
+ }
345
350
  function recordOf(value) {
346
351
  const s = snapshotOf(value);
347
352
  return typeof s === 'object' && s !== null && !Array.isArray(s) ? s : undefined;
@@ -357,19 +362,29 @@ function sampleValue(v, depth, run) {
357
362
  }
358
363
  function sampleObject(src, depth, run) {
359
364
  const hit = run.done.get(src);
360
- if (hit !== undefined)
365
+ if (hit !== undefined) {
366
+ if (hit === null || LOSSY.has(hit))
367
+ run.lost++;
361
368
  return hit ?? undefined;
362
- if (SAMPLED.has(src))
369
+ }
370
+ if (SAMPLED.has(src)) {
371
+ if (LOSSY.has(src))
372
+ run.lost++;
363
373
  return src;
364
- if (run.path.has(src))
374
+ }
375
+ if (run.path.has(src)) {
376
+ run.lost++;
365
377
  return undefined;
378
+ }
366
379
  if (depth >= SAMPLE_MAX_DEPTH) {
367
380
  run.depthCuts++;
381
+ run.lost++;
368
382
  return undefined;
369
383
  }
370
384
  if (run.seen.has(src)) {
371
385
  if (++run.rework > SAMPLE_MAX_REWORK) {
372
386
  run.depthCuts++;
387
+ run.lost++;
373
388
  return undefined;
374
389
  }
375
390
  }
@@ -384,10 +399,12 @@ function sampleObject(src, depth, run) {
384
399
  }
385
400
  catch {
386
401
  run.done.set(src, null);
402
+ run.lost++;
387
403
  return undefined;
388
404
  }
389
405
  run.path.add(src);
390
406
  const cutsBefore = run.depthCuts;
407
+ const lostBefore = run.lost;
391
408
  try {
392
409
  const rec = {};
393
410
  const arr = [];
@@ -409,18 +426,29 @@ function sampleObject(src, depth, run) {
409
426
  const index = isArray ? arrayIndexOfKey(k) : undefined;
410
427
  if (isArray && index === undefined)
411
428
  continue;
412
- if (index !== undefined && index >= SAMPLE_MAX_INDEX)
429
+ if (index !== undefined && index >= SAMPLE_MAX_INDEX) {
430
+ run.lost++;
413
431
  continue;
432
+ }
414
433
  if (index !== undefined && index + 1 > tail)
415
434
  tail = index + 1;
416
435
  const d = guardedRead(() => Object.getOwnPropertyDescriptor(src, k));
417
- if (d === undefined)
436
+ if (d === undefined) {
437
+ run.lost++;
418
438
  continue;
419
- if (d.enumerable !== true || !Object.hasOwn(d, 'value'))
439
+ }
440
+ if (d.enumerable !== true)
420
441
  continue;
442
+ if (!Object.hasOwn(d, 'value')) {
443
+ run.lost++;
444
+ continue;
445
+ }
421
446
  const child = sampleValue(d.value, depth + 1, run);
422
- if (child === undefined)
447
+ if (child === undefined) {
448
+ if (typeof d.value === 'bigint')
449
+ run.lost++;
423
450
  continue;
451
+ }
424
452
  if (index !== undefined) {
425
453
  Object.defineProperty(arr, index, { value: child, writable: true, enumerable: true, configurable: true });
426
454
  if (index + 1 > good)
@@ -431,12 +459,16 @@ function sampleObject(src, depth, run) {
431
459
  }
432
460
  if (isArray) {
433
461
  const want = Math.max(good, Math.min(Math.max(tail, declared), good + SAMPLE_MAX_TRAILING_HOLES));
462
+ if (Math.max(tail, declared) > want)
463
+ run.lost++;
434
464
  if (arr.length < want)
435
465
  arr.length = want;
436
466
  }
437
467
  const out = isArray ? arr : rec;
438
468
  Object.freeze(out);
439
469
  SAMPLED.add(out);
470
+ if (run.lost !== lostBefore)
471
+ LOSSY.add(out);
440
472
  if (run.depthCuts === cutsBefore)
441
473
  run.done.set(src, out);
442
474
  return out;
@@ -453,3 +485,34 @@ export function workflowCompletionExtrasOf(c) {
453
485
  ...(diagnostics !== undefined ? { diagnostics } : {}),
454
486
  };
455
487
  }
488
+ const DROPPED_KEYS_MAX = 256;
489
+ const DROPPED_KEY_NAME_MAX = 128;
490
+ export function resupplyTruncatedFactsOf(slot) {
491
+ try {
492
+ if (typeof slot !== 'object' || slot === null || Array.isArray(slot))
493
+ return undefined;
494
+ const bytes = guardedRead(() => readOwnDataValue(slot, 'bytes'));
495
+ if (typeof bytes !== 'number' || !Number.isSafeInteger(bytes) || bytes <= 0)
496
+ return undefined;
497
+ const keys = guardedRead(() => readOwnDataValue(slot, 'droppedKeys'));
498
+ if (!Array.isArray(keys))
499
+ return undefined;
500
+ const length = guardedRead(() => keys.length);
501
+ if (typeof length !== 'number' || length < 1 || length > DROPPED_KEYS_MAX)
502
+ return undefined;
503
+ const names = [];
504
+ for (let i = 0; i < length; i++) {
505
+ const name = guardedRead(() => readOwnDataValue(keys, String(i)));
506
+ if (typeof name !== 'string' || name.length === 0 || name.length > DROPPED_KEY_NAME_MAX)
507
+ return undefined;
508
+ appendOwnElement(names, name);
509
+ }
510
+ return Object.freeze({ bytes, droppedKeys: Object.freeze(names) });
511
+ }
512
+ catch {
513
+ return undefined;
514
+ }
515
+ }
516
+ export function resupplyTruncatedOf(carrier) {
517
+ return resupplyTruncatedFactsOf(guardedRead(() => readOwnDataValue(carrier, 'payloadTruncated')));
518
+ }
@@ -0,0 +1,4 @@
1
+ export declare const PENDING_USER_ROW_ID_PREFIX = "pending-";
2
+ export declare function pendingUserRowIdOf(uuid: string): string | undefined;
3
+ export declare function pendingUserRowUuidOf(id: string | null | undefined): string | undefined;
4
+ export declare function isPendingUserRowId(id: string | null | undefined): boolean;
@@ -0,0 +1,16 @@
1
+ export const PENDING_USER_ROW_ID_PREFIX = 'pending-';
2
+ const UUID_V4 = /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
3
+ export function pendingUserRowIdOf(uuid) {
4
+ if (typeof uuid !== 'string' || !UUID_V4.test(uuid))
5
+ return undefined;
6
+ return PENDING_USER_ROW_ID_PREFIX + uuid;
7
+ }
8
+ export function pendingUserRowUuidOf(id) {
9
+ if (typeof id !== 'string' || !id.startsWith(PENDING_USER_ROW_ID_PREFIX))
10
+ return undefined;
11
+ const uuid = id.slice(PENDING_USER_ROW_ID_PREFIX.length);
12
+ return pendingUserRowIdOf(uuid) === id ? uuid : undefined;
13
+ }
14
+ export function isPendingUserRowId(id) {
15
+ return pendingUserRowUuidOf(id) !== undefined;
16
+ }
@@ -1,5 +1,6 @@
1
1
  import { type CoreValuePortName } from './coreValuePorts.js';
2
2
  import { type PermissionsAllowGrantReading } from './permissionsAllowGrantCapability.js';
3
+ import type { UiLanguage } from './env/uiLanguage.js';
3
4
  declare const SETTINGS_SOURCE_TIERS: Readonly<{
4
5
  readonly policySettings: "managed";
5
6
  readonly flagSettings: "global";
@@ -115,7 +116,8 @@ export declare function assembledRuleRows(input: PermissionsDeclarationInput, ca
115
116
  export interface PermissionsAllowKeptFacts {
116
117
  readonly problemCount?: number;
117
118
  readonly managedPolicyPending?: true;
119
+ readonly managedPolicyFetch?: 'in_progress' | 'failed' | 'unknown';
118
120
  readonly where?: string;
119
121
  }
120
- export declare function permissionsAllowKeptNotice(report: Pick<PermissionsDeclarationReport, 'kept'>, settingsRead: 'clean' | 'partial' | 'unreadable', facts?: PermissionsAllowKeptFacts): string | undefined;
122
+ export declare function permissionsAllowKeptNotice(report: Pick<PermissionsDeclarationReport, 'kept'>, settingsRead: 'clean' | 'partial' | 'unreadable', facts?: PermissionsAllowKeptFacts, lang?: UiLanguage): string | undefined;
121
123
  export {};