@sema-agent/client-core 0.94.0 → 0.95.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 +341 -0
- package/README.md +70 -47
- package/dist/adapt/arms.js +5 -6
- package/dist/adapt/panelTasks.js +4 -10
- package/dist/adapt/toolCards.js +2 -2
- package/dist/adapt/wireShapes.js +3 -8
- package/dist/adapter/activeRunSelfHeal.d.ts +8 -3
- package/dist/adapter/activeRunSelfHeal.js +20 -12
- package/dist/adapter/downstream/eventToSdkMessage.js +24 -17
- package/dist/adapter/downstream/terminalToSdkResult.js +11 -3
- package/dist/adapter/runStream.js +2 -1
- package/dist/adapter/types.d.ts +7 -0
- package/dist/adapter/types.js +15 -0
- package/dist/agentSession/backgroundView.js +5 -1
- package/dist/agentSession/engineAgentRegistryRead.js +2 -1
- package/dist/agentSession/engineSessionBackgroundStop.js +3 -2
- package/dist/agentsWireCaps.d.ts +2 -0
- package/dist/approvalDecidedByCapability.d.ts +0 -1
- package/dist/approvalDecidedByCapability.js +2 -7
- package/dist/approvalsStreamLiveCapability.d.ts +0 -1
- package/dist/approvalsStreamLiveCapability.js +2 -6
- package/dist/atMostOnce.d.ts +8 -0
- package/dist/atMostOnce.js +36 -0
- package/dist/attachmentSeatCapability.d.ts +0 -1
- package/dist/attachmentSeatCapability.js +0 -3
- package/dist/attachmentsWireCaps.js +11 -6
- package/dist/bashExitReading.d.ts +10 -0
- package/dist/bashExitReading.js +12 -0
- package/dist/callerCwdCapability.d.ts +0 -1
- package/dist/callerCwdCapability.js +2 -7
- package/dist/centerWiringCapability.d.ts +1 -3
- package/dist/centerWiringCapability.js +18 -21
- package/dist/classifierStatus.js +4 -4
- package/dist/cloudConfigWireCaps.js +43 -21
- package/dist/compensations.js +1 -1
- package/dist/cycleOrder.d.ts +15 -0
- package/dist/cycleOrder.js +45 -0
- package/dist/decideFailureNote.js +4 -1
- package/dist/decideReceipt.d.ts +2 -1
- package/dist/decideReceipt.js +41 -13
- package/dist/declared/supportFloorDeclared.d.ts +1 -0
- package/dist/declared/supportFloorDeclared.js +5 -0
- package/dist/deviceExecutorManagementCapability.d.ts +0 -1
- package/dist/deviceExecutorManagementCapability.js +7 -16
- package/dist/deviceRebind.d.ts +88 -0
- package/dist/deviceRebind.js +242 -0
- package/dist/displayUntrusted.d.ts +1 -0
- package/dist/displayUntrusted.js +313 -11
- package/dist/engineAgentAbsence.d.ts +2 -2
- package/dist/engineAgentPanelStore.d.ts +8 -18
- package/dist/engineAgentPanelStore.js +19 -537
- package/dist/engineCapReader.d.ts +6 -6
- package/dist/engineCapReader.js +30 -43
- package/dist/engineCapsCache.d.ts +7 -2
- package/dist/engineCapsCache.js +64 -26
- package/dist/engineCredentialRequirement.d.ts +9 -0
- package/dist/engineCredentialRequirement.js +23 -0
- package/dist/engineEnvSourcing.d.ts +53 -0
- package/dist/engineEnvSourcing.js +81 -0
- package/dist/engineErrorCodes.d.ts +14 -3
- package/dist/engineErrorCodes.js +31 -10
- package/dist/engineIdentity.js +2 -0
- package/dist/engineWireSdk.js +2 -2
- package/dist/executionLaneCapability.d.ts +2 -3
- package/dist/executionLaneCapability.js +18 -23
- package/dist/fileHistoryCaptureCapability.d.ts +0 -1
- package/dist/fileHistoryCaptureCapability.js +2 -6
- package/dist/fileHistoryLegNotice.d.ts +3 -2
- package/dist/fileHistoryLegNotice.js +51 -2
- package/dist/fleet/fleetLedger.d.ts +2 -0
- package/dist/fleet/fleetLedger.js +69 -52
- package/dist/fleet/fleetProjection.d.ts +0 -3
- package/dist/fleet/fleetProjection.js +9 -16
- package/dist/fleetAgentPanelProjection.d.ts +4 -17
- package/dist/fleetAgentPanelProjection.js +7 -197
- package/dist/fleetAgentRowLike.d.ts +16 -0
- package/dist/fleetAgentRowLike.js +1 -0
- package/dist/gateOutcome.js +30 -18
- package/dist/generated/sdkFactTables.d.ts +2 -0
- package/dist/generated/sdkFactTables.js +17 -0
- package/dist/generated/settingsSchemaFns.d.ts +10 -0
- package/dist/generated/settingsSchemaFns.js +22 -0
- package/dist/headlessPermissionModeWire.d.ts +1 -1
- package/dist/headlessPermissionModeWire.js +1 -1
- package/dist/headlessReconnectWire.js +49 -20
- package/dist/hitl/allowRuleShadow.d.ts +1 -1
- package/dist/hitl/allowRuleShadow.js +49 -8
- package/dist/hitl/approvalCompleteParked.d.ts +1 -0
- package/dist/hitl/approvalCompleteParked.js +14 -0
- package/dist/hitl/approvalEndingCause.d.ts +5 -0
- package/dist/hitl/approvalEndingCause.js +61 -0
- package/dist/hitl/approvalHolds.d.ts +12 -2
- package/dist/hitl/approvalHolds.js +53 -2
- package/dist/hitl/approvalsFeed.js +23 -11
- package/dist/hitl/askGateWire.d.ts +2 -1
- package/dist/hitl/askGateWire.js +26 -1
- package/dist/hitl/automaticAnswerVerdict.js +2 -2
- package/dist/hitl/crashConverged.js +2 -0
- package/dist/hitl/decisionConflict.d.ts +3 -0
- package/dist/hitl/decisionConflict.js +43 -0
- package/dist/hitl/decisionRefusal.d.ts +4 -0
- package/dist/hitl/decisionRefusal.js +26 -1
- package/dist/hitl/frameRouter.js +26 -43
- package/dist/hitl/gateLedger.d.ts +5 -0
- package/dist/hitl/gateLedger.js +21 -0
- package/dist/hitl/hitlBridge.d.ts +12 -1
- package/dist/hitl/hitlBridge.js +68 -53
- package/dist/hitl/hitlHostSurface.js +3 -11
- package/dist/hitl/livePendingAsk.d.ts +16 -6
- package/dist/hitl/livePendingAsk.js +36 -4
- package/dist/hitl/parkExpiryJudgements.d.ts +19 -0
- package/dist/hitl/parkExpiryJudgements.js +46 -0
- package/dist/hitl/parkResolver.d.ts +3 -7
- package/dist/hitl/parkResolver.js +50 -26
- package/dist/hitl/persistedRulesWire.js +5 -1
- package/dist/hitl/planReviewWire.d.ts +2 -2
- package/dist/hitl/planReviewWire.js +56 -30
- package/dist/hitl/replayedApproval.d.ts +8 -0
- package/dist/hitl/replayedApproval.js +125 -10
- package/dist/hitl/resumeRunningCard.d.ts +2 -0
- package/dist/hitl/resumeRunningCard.js +15 -4
- package/dist/hitl/toolApprovalWire.d.ts +24 -4
- package/dist/hitl/toolApprovalWire.js +115 -38
- package/dist/hooksWireCaps.js +38 -6
- package/dist/host.d.ts +5 -0
- package/dist/host.js +3 -1
- package/dist/hostCallbackGuard.d.ts +1 -0
- package/dist/hostCallbackGuard.js +25 -0
- package/dist/index.d.ts +30 -11
- package/dist/index.js +20 -8
- package/dist/interactiveInterrupt.d.ts +8 -0
- package/dist/interactiveInterrupt.js +54 -0
- package/dist/limitsWire.d.ts +5 -0
- package/dist/limitsWire.js +49 -3
- package/dist/liveModelCatalog.d.ts +95 -0
- package/dist/liveModelCatalog.js +297 -32
- package/dist/mcpEngineLeg.d.ts +25 -0
- package/dist/mcpEngineLeg.js +71 -15
- package/dist/mcpPanel.js +2 -1
- package/dist/mcpProbeCapability.d.ts +0 -1
- package/dist/mcpProbeCapability.js +2 -6
- package/dist/mcpReconnect.d.ts +1 -3
- package/dist/mcpReconnect.js +10 -5
- package/dist/memoryComplianceCapability.d.ts +0 -1
- package/dist/memoryComplianceCapability.js +2 -6
- package/dist/memoryOriginCapability.d.ts +0 -1
- package/dist/memoryOriginCapability.js +2 -6
- package/dist/memoryVerbsWire.d.ts +1 -1
- package/dist/memoryVerbsWire.js +4 -0
- package/dist/model/liveCatalogShape.d.ts +14 -0
- package/dist/model/liveCatalogShape.js +71 -0
- package/dist/model/modelSupplyRules.d.ts +1 -0
- package/dist/model/modelSupplyRules.js +30 -9
- package/dist/model/modelsPolicy.d.ts +21 -0
- package/dist/model/modelsPolicy.js +90 -0
- package/dist/modelIdentityResolvability.d.ts +1 -1
- package/dist/modelIdentityResolvability.js +5 -12
- package/dist/modelSwitchFallback.d.ts +69 -0
- package/dist/modelSwitchFallback.js +206 -0
- package/dist/notifications.js +12 -11
- package/dist/outputStyleSeatCapability.d.ts +0 -1
- package/dist/outputStyleSeatCapability.js +2 -7
- package/dist/ownKey.d.ts +6 -0
- package/dist/ownKey.js +48 -0
- package/dist/panelReduce.d.ts +114 -0
- package/dist/panelReduce.js +1135 -0
- package/dist/panelStateHolder.d.ts +17 -0
- package/dist/panelStateHolder.js +201 -0
- package/dist/peerLaneCapability.d.ts +0 -1
- package/dist/peerLaneCapability.js +2 -6
- package/dist/permissionModesCapability.d.ts +0 -1
- package/dist/permissionModesCapability.js +5 -10
- package/dist/permissionRulesWriteCapability.d.ts +0 -1
- package/dist/permissionRulesWriteCapability.js +2 -6
- package/dist/permissionsAllowGrantCapability.d.ts +0 -1
- package/dist/permissionsAllowGrantCapability.js +3 -9
- package/dist/permissionsDeclaration.d.ts +6 -0
- package/dist/permissionsDeclaration.js +45 -0
- package/dist/printToolResultFrame.js +2 -10
- package/dist/promptDelivery.js +0 -8
- package/dist/resumeRefusalCopy.d.ts +18 -1
- package/dist/resumeRefusalCopy.js +126 -15
- package/dist/rewindArchiveCapability.d.ts +2 -1
- package/dist/rewindArchiveCapability.js +15 -7
- package/dist/rewindEngineAction.d.ts +21 -0
- package/dist/rewindEngineAction.js +36 -0
- package/dist/rewindWireCaps.d.ts +2 -1
- package/dist/rewindWireCaps.js +1 -0
- package/dist/runTerminal.d.ts +0 -11
- package/dist/runTerminal.js +4 -27
- package/dist/sdkRegistryTransit.d.ts +2 -1
- package/dist/sdkRegistryTransit.js +1 -0
- package/dist/sealedKeyCapability.d.ts +0 -1
- package/dist/sealedKeyCapability.js +3 -9
- package/dist/seatContract.d.ts +54 -25
- package/dist/seatContract.js +394 -171
- package/dist/sessionIdSegment.d.ts +1 -0
- package/dist/sessionIdSegment.js +11 -0
- package/dist/sessionMemoryErase.d.ts +1 -1
- package/dist/sessionMemoryErase.js +6 -1
- package/dist/sessionMemoryStatus.js +3 -2
- package/dist/sessionPolicyCapability.d.ts +0 -1
- package/dist/sessionPolicyCapability.js +2 -6
- package/dist/sessionReadRedactionCapability.d.ts +0 -1
- package/dist/sessionReadRedactionCapability.js +2 -7
- package/dist/sessionSyncFileHistoryCapability.d.ts +0 -1
- package/dist/sessionSyncFileHistoryCapability.js +2 -6
- package/dist/skillToolListsCapability.d.ts +0 -1
- package/dist/skillToolListsCapability.js +2 -6
- package/dist/skillsWireCaps.d.ts +4 -0
- package/dist/skillsWireCaps.js +66 -1
- package/dist/sqlEngineCapability.d.ts +0 -1
- package/dist/sqlEngineCapability.js +9 -14
- package/dist/steerPriorityCapability.d.ts +0 -1
- package/dist/steerPriorityCapability.js +3 -9
- package/dist/storePostureCapability.d.ts +1 -1
- package/dist/storePostureCapability.js +16 -16
- package/dist/streamDrainingLegs.d.ts +6 -0
- package/dist/streamDrainingLegs.js +23 -0
- package/dist/subagent/engineCompactWire.js +13 -38
- package/dist/subagent/engineDelegatedPrompt.js +10 -6
- package/dist/subagent/engineSubagentOutput.d.ts +0 -1
- package/dist/subagent/engineSubagentOutput.js +5 -20
- package/dist/subagent/engineSubagentTail.d.ts +0 -1
- package/dist/subagent/engineSubagentTail.js +7 -32
- package/dist/subagentContentStore.js +3 -3
- package/dist/supportFloor.js +2 -5
- package/dist/terminalStatuses.d.ts +30 -0
- package/dist/terminalStatuses.js +67 -0
- package/dist/toolResult.d.ts +5 -0
- package/dist/toolResult.js +88 -36
- package/dist/types/engineState.d.ts +2 -1
- package/dist/usageAnalytics.d.ts +146 -0
- package/dist/usageAnalytics.js +311 -0
- package/dist/userInvokedSkillsCapability.d.ts +0 -1
- package/dist/userInvokedSkillsCapability.js +2 -6
- package/dist/webSearchBackendCapability.d.ts +0 -1
- package/dist/webSearchBackendCapability.js +3 -7
- package/dist/webSearchWireCaps.js +3 -11
- package/dist/wireFailureShape.d.ts +4 -0
- package/dist/wireFailureShape.js +42 -2
- package/dist/wireRefusalCopy.js +2 -18
- package/dist/workflowClient.js +7 -11
- package/dist/workflowsJournalCapability.d.ts +0 -1
- package/dist/workflowsJournalCapability.js +2 -6
- package/dist/writeProtectionCapability.d.ts +0 -1
- package/dist/writeProtectionCapability.js +5 -10
- package/docs/INTEGRATION-CLIENTS.md +1033 -26
- package/package.json +5 -5
- package/dist/engineCapsGenerationGuard.d.ts +0 -4
- package/dist/engineCapsGenerationGuard.js +0 -19
- package/dist/panelRunningHistory.d.ts +0 -22
- package/dist/panelRunningHistory.js +0 -82
- package/dist/registryConflict.d.ts +0 -3
- package/dist/registryConflict.js +0 -44
package/dist/displayUntrusted.js
CHANGED
|
@@ -103,8 +103,8 @@ function valueIsWholeMarker(S, start, end, tokenInner = true) {
|
|
|
103
103
|
return j >= end || !isKeyWordChar(text.charCodeAt(j)) || credentialWordStartsExactlyAt(text, j, tokenInner) || credentialPairAt(S, j);
|
|
104
104
|
}
|
|
105
105
|
const CREDENTIAL_NAME = /(?:(?:access|refresh|id|client|api|x[-_]api|session|auth)[-_]?)?(?:token|key|secret|password|authorization|credential)s?|bearer|basic/iy;
|
|
106
|
-
const LABEL_SEPARATOR = /(?:\\*["'])?[\s\u115F\u1160\u3164\uFFA0\u2800]*[:=\uFF1A\uFF1D]/y;
|
|
107
|
-
const SCHEME_SEPARATOR = /[\s:=\uFF1A\uFF1D\u115F\u1160\u3164\uFFA0\u2800]/y;
|
|
106
|
+
const LABEL_SEPARATOR = /(?:\\*["'])?(?:[\s\u115F\u1160\u3164\uFFA0\u2800]|\\t)*[:=\uFF1A\uFF1D]/y;
|
|
107
|
+
const SCHEME_SEPARATOR = /(?:[\s:=\uFF1A\uFF1D\u115F\u1160\u3164\uFFA0\u2800]|\\t)/y;
|
|
108
108
|
function credentialPairAt(S, at) {
|
|
109
109
|
const text = S.text;
|
|
110
110
|
const re = new RegExp(CREDENTIAL_NAME.source, 'iy');
|
|
@@ -286,15 +286,22 @@ function pathCandidates(src, base, path, opaqueSegments, edits, soft) {
|
|
|
286
286
|
for (const segment of path.split('/')) {
|
|
287
287
|
const semi = segment.indexOf(';');
|
|
288
288
|
const head = semi === -1 ? segment : segment.slice(0, semi);
|
|
289
|
-
if (opaqueSegments
|
|
289
|
+
if (opaqueSegments) {
|
|
290
290
|
let a = 0;
|
|
291
291
|
let b = head.length;
|
|
292
292
|
while (a < b && !isKeyWordChar(head.charCodeAt(a)))
|
|
293
293
|
a++;
|
|
294
294
|
while (b > a && !isKeyWordChar(head.charCodeAt(b - 1)))
|
|
295
295
|
b--;
|
|
296
|
-
if (
|
|
297
|
-
|
|
296
|
+
if (isKnownSecretSegment(head)) {
|
|
297
|
+
if (b > a)
|
|
298
|
+
pushEdit(edits, src, pos + a, pos + b, REDACTED_SECRET);
|
|
299
|
+
}
|
|
300
|
+
else if (b > a) {
|
|
301
|
+
const glued = gluedLiteralStart(head.slice(a, b));
|
|
302
|
+
if (glued > 0)
|
|
303
|
+
pushEdit(edits, src, pos + a + glued, pos + b, REDACTED_SECRET);
|
|
304
|
+
}
|
|
298
305
|
}
|
|
299
306
|
if (semi !== -1) {
|
|
300
307
|
let ppos = pos + semi + 1;
|
|
@@ -401,6 +408,7 @@ function urlCandidates(text, out, regions, unitPos = () => false, soft) {
|
|
|
401
408
|
runStart--;
|
|
402
409
|
if (runStart < end && !VALUE_BOUNDARY_TAIL.test(text.slice(start, runStart)))
|
|
403
410
|
end = runStart;
|
|
411
|
+
end = trailingCloserEnd(text, start, mark + 3, end, unitPos);
|
|
404
412
|
const tokenEdits = [];
|
|
405
413
|
urlTokenCandidatesAt(text, start, end, tokenEdits, soft);
|
|
406
414
|
editsToCandidates(tokenEdits, 'url', out, end);
|
|
@@ -420,6 +428,47 @@ function urlCandidates(text, out, regions, unitPos = () => false, soft) {
|
|
|
420
428
|
mark = text.indexOf('://', end > mark + 3 ? end : mark + 3);
|
|
421
429
|
}
|
|
422
430
|
}
|
|
431
|
+
function trailingCloserEnd(text, start, floor, end, unitPos) {
|
|
432
|
+
const opens = new Map();
|
|
433
|
+
const closes = new Map();
|
|
434
|
+
for (const [o, c] of BRACKET_PAIRS) {
|
|
435
|
+
opens.set(o, 0);
|
|
436
|
+
closes.set(c, 0);
|
|
437
|
+
}
|
|
438
|
+
for (let k = start; k < end; k++) {
|
|
439
|
+
if (unitPos(k))
|
|
440
|
+
continue;
|
|
441
|
+
const ch = text.charAt(k);
|
|
442
|
+
const o = opens.get(ch);
|
|
443
|
+
if (o !== undefined)
|
|
444
|
+
opens.set(ch, o + 1);
|
|
445
|
+
const c = closes.get(ch);
|
|
446
|
+
if (c !== undefined)
|
|
447
|
+
closes.set(ch, c + 1);
|
|
448
|
+
}
|
|
449
|
+
let e = end;
|
|
450
|
+
for (;;) {
|
|
451
|
+
if (e <= floor || unitPos(e - 1))
|
|
452
|
+
return e;
|
|
453
|
+
const ch = text.charAt(e - 1);
|
|
454
|
+
const c = closes.get(ch);
|
|
455
|
+
if (c === undefined)
|
|
456
|
+
return e;
|
|
457
|
+
let open = '';
|
|
458
|
+
for (const [o, cl] of BRACKET_PAIRS)
|
|
459
|
+
if (cl === ch)
|
|
460
|
+
open = o;
|
|
461
|
+
if (c <= (opens.get(open) ?? 0))
|
|
462
|
+
return e;
|
|
463
|
+
closes.set(ch, c - 1);
|
|
464
|
+
e--;
|
|
465
|
+
let runStart = e;
|
|
466
|
+
while (runStart > floor && TRAILING_PUNCTUATION.has(text.charAt(runStart - 1)))
|
|
467
|
+
runStart--;
|
|
468
|
+
if (runStart < e && !VALUE_BOUNDARY_TAIL.test(text.slice(start, runStart)))
|
|
469
|
+
e = runStart;
|
|
470
|
+
}
|
|
471
|
+
}
|
|
423
472
|
function atInAuthority(text, from) {
|
|
424
473
|
for (let p = from; p < text.length; p++) {
|
|
425
474
|
const ch = text.charAt(p);
|
|
@@ -763,9 +812,9 @@ const NAME_BLANK_RANGES = [
|
|
|
763
812
|
const isNameBlank = (cp) => NAME_BLANK_RANGES.some(([a, b]) => cp >= a && cp <= b);
|
|
764
813
|
const isFoldedBlank = (c) => isNameBlank(c) && isRegexSpace(c);
|
|
765
814
|
const isUnicodeBlank = (c) => (c > 0x7f && isRegexSpace(c) && c !== 0xfeff) || isNameBlank(c);
|
|
766
|
-
const SECRET_SCHEME_WORD = /(?:\b|(?<=\\[A-Za-z"']))(bearer|basic|token)[\s:=\uFF1A\uFF1D\u115F\u1160\u3164\uFFA0\u2800]+/gi;
|
|
815
|
+
const SECRET_SCHEME_WORD = /(?:\b|(?<=\\[A-Za-z"']))(?!(?<=(?<!\\)\\)(?:bearer|basic|token)\\t)(bearer|basic|token)(?:[\s:=\uFF1A\uFF1D\u115F\u1160\u3164\uFFA0\u2800]|\\t)+/gi;
|
|
767
816
|
const schemeWordIsInner = (word, tokenInner) => tokenInner || word.toLowerCase() !== 'token';
|
|
768
|
-
const SECRET_LABELLED_WORD = /(?:\b|(?<=_)|(?<=\\[A-Za-z"']))((?:access[-_ ]?|refresh[-_ ]?|id[-_ ]?|client[-_ ]?|api[-_ ]?|x[-_]api[-_ ]?|session[-_ ]?|auth[-_ ]?)?(?:token|key|secret|password|authorization|credential)s?)(?:\\*["'])?[\s\u115F\u1160\u3164\uFFA0\u2800]*[:=\uFF1A\uFF1D][\s\u115F\u1160\u3164\uFFA0\u2800]*/gi;
|
|
817
|
+
const SECRET_LABELLED_WORD = /(?:\b|(?<=_)|(?<=\\[A-Za-z"']))((?:access[-_ ]?|refresh[-_ ]?|id[-_ ]?|client[-_ ]?|api[-_ ]?|x[-_]api[-_ ]?|session[-_ ]?|auth[-_ ]?)?(?:token|key|secret|password|authorization|credential)s?)(?:\\*["'])?(?:[\s\u115F\u1160\u3164\uFFA0\u2800]|\\t)*[:=\uFF1A\uFF1D](?:[\s\u115F\u1160\u3164\uFFA0\u2800]|\\t)*/gi;
|
|
769
818
|
const DIAGNOSTIC_VALUE_WORDS = new Set([
|
|
770
819
|
'missing', 'required', 'invalid', 'expired', 'unauthorized', 'unauthenticated', 'authentication',
|
|
771
820
|
'authorization', 'credential', 'credentials', 'unsupported', 'malformed', 'rejected', 'absent',
|
|
@@ -820,18 +869,67 @@ const AUTH_SCHEME_WORDS = new Set([
|
|
|
820
869
|
const AUTH_SIGNATURE_SCHEME = /^[A-Z][A-Z0-9]*(?:-[A-Z0-9]+){2,}$/;
|
|
821
870
|
const BARE_VALUE_STOP_CHARS = new Set([',', ';', '"', "'", '\\', '(', ')', '[', ']', '{', '}', '<', '>']);
|
|
822
871
|
const isBareValueStop = (ch) => ch <= ' ' || BARE_VALUE_STOP_CHARS.has(ch);
|
|
872
|
+
function isPlainAt(S, rawUnit, k) {
|
|
873
|
+
if (S.dropped(k) || S.painted(k) || S.unitAt(k) !== UNIT_NONE)
|
|
874
|
+
return false;
|
|
875
|
+
return rawUnit === null || rawUnit[S.rawStart(k)] !== 1;
|
|
876
|
+
}
|
|
877
|
+
function codeSpanClose(text, plain) {
|
|
878
|
+
const n = text.length;
|
|
879
|
+
const close = new Int32Array(n + 1).fill(-1);
|
|
880
|
+
let openLen = 0;
|
|
881
|
+
let spanFrom = -1;
|
|
882
|
+
let k = 0;
|
|
883
|
+
while (k < n) {
|
|
884
|
+
const c = text.charCodeAt(k);
|
|
885
|
+
if (c === 0x0a || c === 0x0d || c === 0x2028 || c === 0x2029) {
|
|
886
|
+
openLen = 0;
|
|
887
|
+
spanFrom = -1;
|
|
888
|
+
k++;
|
|
889
|
+
continue;
|
|
890
|
+
}
|
|
891
|
+
if (c !== 0x60 || !plain(k)) {
|
|
892
|
+
k++;
|
|
893
|
+
continue;
|
|
894
|
+
}
|
|
895
|
+
let e = k;
|
|
896
|
+
while (e < n && text.charCodeAt(e) === 0x60 && plain(e))
|
|
897
|
+
e++;
|
|
898
|
+
const len = e - k;
|
|
899
|
+
if (openLen === 0) {
|
|
900
|
+
openLen = len;
|
|
901
|
+
spanFrom = e;
|
|
902
|
+
}
|
|
903
|
+
else if (len === openLen) {
|
|
904
|
+
for (let x = spanFrom; x < k; x++)
|
|
905
|
+
close[x] = k;
|
|
906
|
+
openLen = 0;
|
|
907
|
+
spanFrom = -1;
|
|
908
|
+
}
|
|
909
|
+
k = e;
|
|
910
|
+
}
|
|
911
|
+
return close;
|
|
912
|
+
}
|
|
913
|
+
const BRACKET_PAIRS = new Map([['(', ')'], ['[', ']']]);
|
|
823
914
|
class InnerWordIndex {
|
|
824
915
|
text;
|
|
825
916
|
tokenInner;
|
|
826
917
|
probes;
|
|
827
|
-
|
|
918
|
+
plain;
|
|
919
|
+
spanClose = null;
|
|
920
|
+
constructor(text, tokenInner = true, plain = () => true) {
|
|
828
921
|
this.text = text;
|
|
829
922
|
this.tokenInner = tokenInner;
|
|
923
|
+
this.plain = plain;
|
|
830
924
|
this.probes = [
|
|
831
925
|
{ re: new RegExp(SECRET_LABELLED_WORD.source, SECRET_LABELLED_WORD.flags), scheme: false, from: -1, hit: null },
|
|
832
926
|
{ re: new RegExp(SECRET_SCHEME_WORD.source, SECRET_SCHEME_WORD.flags), scheme: true, from: -1, hit: null },
|
|
833
927
|
];
|
|
834
928
|
}
|
|
929
|
+
closingTickFrom(i) {
|
|
930
|
+
this.spanClose ??= codeSpanClose(this.text, this.plain);
|
|
931
|
+
return this.spanClose[i] ?? -1;
|
|
932
|
+
}
|
|
835
933
|
next(q) {
|
|
836
934
|
let best = null;
|
|
837
935
|
for (const p of this.probes) {
|
|
@@ -857,6 +955,45 @@ class InnerWordIndex {
|
|
|
857
955
|
return best;
|
|
858
956
|
}
|
|
859
957
|
}
|
|
958
|
+
const WRAPPED_PLACEHOLDER = /^(?:[A-Z]{1,12}(?:_[A-Z]{1,12})*|[a-z]{1,12}(?:-[a-z]{1,12})*)$/;
|
|
959
|
+
function wrappedValueAt(text, from, idx) {
|
|
960
|
+
let k = from;
|
|
961
|
+
while (k < text.length && text[k] === VIEW_SEPARATOR)
|
|
962
|
+
k++;
|
|
963
|
+
const close = BRACKET_PAIRS.get(text.charAt(k));
|
|
964
|
+
if (close === undefined || credentialWordStartsAt(text, k + 1, idx.tokenInner))
|
|
965
|
+
return null;
|
|
966
|
+
const inner = scanSecretValue(text, k + 1, idx);
|
|
967
|
+
if (inner === null || inner.start !== k + 1)
|
|
968
|
+
return null;
|
|
969
|
+
let c = inner.end;
|
|
970
|
+
while (c < text.length && text[c] === VIEW_SEPARATOR)
|
|
971
|
+
c++;
|
|
972
|
+
if (text.charAt(c) !== close || (close === ']' && text.charAt(c + 1) === '('))
|
|
973
|
+
return null;
|
|
974
|
+
return inner;
|
|
975
|
+
}
|
|
976
|
+
function tokenSchemeValueEnd(text, start, end, idx) {
|
|
977
|
+
if (withoutSeparators(text.slice(start, end)).toLowerCase() !== 'token')
|
|
978
|
+
return -1;
|
|
979
|
+
const re = new RegExp(SECRET_SCHEME_WORD.source, 'iy');
|
|
980
|
+
re.lastIndex = start;
|
|
981
|
+
const m = re.exec(text);
|
|
982
|
+
if (m === null || (m[1] ?? '').toLowerCase() !== 'token')
|
|
983
|
+
return -1;
|
|
984
|
+
const sepEnd = start + m[0].length;
|
|
985
|
+
if (/[\n\r\u2028\u2029:=\uFF1A\uFF1D]/.test(text.slice(start + (m[1] ?? '').length, sepEnd)))
|
|
986
|
+
return -1;
|
|
987
|
+
if (credentialWordStartsAt(text, sepEnd, idx.tokenInner))
|
|
988
|
+
return -1;
|
|
989
|
+
const iv = scanSecretValue(text, sepEnd, idx);
|
|
990
|
+
if (iv === null)
|
|
991
|
+
return -1;
|
|
992
|
+
const inner = withoutSeparators(text.slice(iv.start, iv.end));
|
|
993
|
+
if (schemeFollowerReleased('token', inner, false) || isDiagnosticWord(inner))
|
|
994
|
+
return -1;
|
|
995
|
+
return iv.end;
|
|
996
|
+
}
|
|
860
997
|
function innerWordFits(text, w) {
|
|
861
998
|
for (let k = w.start; k <= w.sepAt && k < text.length; k++)
|
|
862
999
|
if (isBareValueStop(text.charAt(k)))
|
|
@@ -912,6 +1049,7 @@ function scanSecretValue(text, from, idx) {
|
|
|
912
1049
|
let pending = cuttable ? idx.next(i + 1) : null;
|
|
913
1050
|
let cut = false;
|
|
914
1051
|
let j = i;
|
|
1052
|
+
const closingTick = idx === undefined ? -1 : idx.closingTickFrom(i);
|
|
915
1053
|
while (j < text.length) {
|
|
916
1054
|
if (pending !== null && j >= pending.start) {
|
|
917
1055
|
if (j === pending.start && innerWordFits(text, pending)) {
|
|
@@ -936,6 +1074,18 @@ function scanSecretValue(text, from, idx) {
|
|
|
936
1074
|
}
|
|
937
1075
|
while (j > i && text[j - 1] === VIEW_SEPARATOR)
|
|
938
1076
|
j--;
|
|
1077
|
+
if (closingTick > i && closingTick < j) {
|
|
1078
|
+
let t = closingTick;
|
|
1079
|
+
while (t < j && text.charCodeAt(t) === 0x60)
|
|
1080
|
+
t++;
|
|
1081
|
+
while (t < j && TRAILING_PUNCTUATION.has(text.charAt(t)))
|
|
1082
|
+
t++;
|
|
1083
|
+
if (t === j && text.charCodeAt(closingTick) === 0x60) {
|
|
1084
|
+
j = closingTick;
|
|
1085
|
+
while (j > i && text[j - 1] === VIEW_SEPARATOR)
|
|
1086
|
+
j--;
|
|
1087
|
+
}
|
|
1088
|
+
}
|
|
939
1089
|
if (cut) {
|
|
940
1090
|
while (j > i && isCutDelimiter(text.charAt(j - 1))) {
|
|
941
1091
|
j--;
|
|
@@ -955,6 +1105,9 @@ function isDiagnosticValue(value, raw = value) {
|
|
|
955
1105
|
return true;
|
|
956
1106
|
if (ADDRESS_SCHEME_RE.test(raw))
|
|
957
1107
|
return true;
|
|
1108
|
+
return isDiagnosticWord(value);
|
|
1109
|
+
}
|
|
1110
|
+
function isDiagnosticWord(value) {
|
|
958
1111
|
const bare = value.replace(/^\.+/, '').replace(/[.,;:!?)\]}'"]{0,8}$/, '').toLowerCase();
|
|
959
1112
|
return bare === '' || DIAGNOSTIC_VALUE_WORDS.has(bare);
|
|
960
1113
|
}
|
|
@@ -1014,6 +1167,26 @@ function isNamedNotValue(label, value) {
|
|
|
1014
1167
|
return true;
|
|
1015
1168
|
return isBacktickedCredentialName(value);
|
|
1016
1169
|
}
|
|
1170
|
+
function schemeIsLabelValue(text, at) {
|
|
1171
|
+
let k = at;
|
|
1172
|
+
while (k > 0 && text[k - 1] === VIEW_SEPARATOR)
|
|
1173
|
+
k--;
|
|
1174
|
+
if (k > 0 && isQuoteChar(text.charAt(k - 1))) {
|
|
1175
|
+
k--;
|
|
1176
|
+
while (k > 0 && text.charCodeAt(k - 1) === 0x5c)
|
|
1177
|
+
k--;
|
|
1178
|
+
}
|
|
1179
|
+
return k > 0 && labelEndsAt(text, k);
|
|
1180
|
+
}
|
|
1181
|
+
function labelQuotedAt(text, at, sep) {
|
|
1182
|
+
const q = text.charAt(at - 1);
|
|
1183
|
+
if (!isQuoteChar(q))
|
|
1184
|
+
return false;
|
|
1185
|
+
let k = 0;
|
|
1186
|
+
while (sep.charCodeAt(k) === 0x5c)
|
|
1187
|
+
k++;
|
|
1188
|
+
return sep.charAt(k) === q;
|
|
1189
|
+
}
|
|
1017
1190
|
function labelStartsAt(text, at) {
|
|
1018
1191
|
const re = new RegExp(SECRET_LABELLED_WORD.source, 'iy');
|
|
1019
1192
|
re.lastIndex = at;
|
|
@@ -1930,9 +2103,11 @@ function labelCandidates(S, pass, regions, out, blocks) {
|
|
|
1930
2103
|
const re = pass === 'label' ? SECRET_LABELLED_WORD : SECRET_SCHEME_WORD;
|
|
1931
2104
|
const schemePass = pass !== 'label';
|
|
1932
2105
|
const tokenPass = pass === 'token';
|
|
1933
|
-
const
|
|
2106
|
+
const rawUnitMap = blocks?.view.rawUnit ?? null;
|
|
2107
|
+
const plainAt = (k) => isPlainAt(S, rawUnitMap, k);
|
|
2108
|
+
const idx = new InnerWordIndex(text, tokenPass, plainAt);
|
|
1934
2109
|
let listIdx = null;
|
|
1935
|
-
const listIndex = () => (listIdx ??= new InnerWordIndex(text, idx.tokenInner));
|
|
2110
|
+
const listIndex = () => (listIdx ??= new InnerWordIndex(text, idx.tokenInner, plainAt));
|
|
1936
2111
|
let skipFrom = -1;
|
|
1937
2112
|
let skipTo = -1;
|
|
1938
2113
|
const flowBudget = { left: 4 * text.length + 4096, pairs: null };
|
|
@@ -2182,6 +2357,16 @@ function labelCandidates(S, pass, regions, out, blocks) {
|
|
|
2182
2357
|
if (schemePass && labelStartsAt(text, hit.index))
|
|
2183
2358
|
continue;
|
|
2184
2359
|
let from = hit.index + hit[0].length;
|
|
2360
|
+
if (!schemePass && text.charCodeAt(from) === 0x3e && text.charCodeAt(from - 1) === 0x3d && labelQuotedAt(text, hit.index, hit[0].slice(label.length))) {
|
|
2361
|
+
let k = from + 1;
|
|
2362
|
+
while (k < text.length && isInlineBlank(text.charAt(k)))
|
|
2363
|
+
k++;
|
|
2364
|
+
let q = k;
|
|
2365
|
+
while (text.charCodeAt(q) === 0x5c)
|
|
2366
|
+
q++;
|
|
2367
|
+
if (isQuoteChar(text.charAt(q)))
|
|
2368
|
+
from = k;
|
|
2369
|
+
}
|
|
2185
2370
|
const colonSep = isColonSeparator(hit[0].slice((hit[1] ?? '').length));
|
|
2186
2371
|
let bulletSkipped = false;
|
|
2187
2372
|
for (;;) {
|
|
@@ -2244,6 +2429,16 @@ function labelCandidates(S, pass, regions, out, blocks) {
|
|
|
2244
2429
|
}
|
|
2245
2430
|
}
|
|
2246
2431
|
let v0s = scanSecretValue(text, from, idx);
|
|
2432
|
+
let wrapEnd = -1;
|
|
2433
|
+
if (v0s === null) {
|
|
2434
|
+
const w = wrappedValueAt(text, from, idx);
|
|
2435
|
+
if (w !== null) {
|
|
2436
|
+
if (WRAPPED_PLACEHOLDER.test(withoutSeparators(text.slice(w.start, w.end))))
|
|
2437
|
+
continue;
|
|
2438
|
+
v0s = w;
|
|
2439
|
+
wrapEnd = w.end;
|
|
2440
|
+
}
|
|
2441
|
+
}
|
|
2247
2442
|
if (v0s === null) {
|
|
2248
2443
|
let k = from;
|
|
2249
2444
|
while (k < text.length && text[k] === VIEW_SEPARATOR)
|
|
@@ -2340,6 +2535,13 @@ function labelCandidates(S, pass, regions, out, blocks) {
|
|
|
2340
2535
|
if (a !== -1)
|
|
2341
2536
|
v.end = a;
|
|
2342
2537
|
}
|
|
2538
|
+
if (wrapEnd !== -1 && v.end > wrapEnd)
|
|
2539
|
+
v.end = wrapEnd;
|
|
2540
|
+
if (!schemePass && !quoted && wrapEnd === -1 && !inQuery(v.start) && !/authorizations?$/i.test(label)) {
|
|
2541
|
+
const ext = tokenSchemeValueEnd(text, v.start, v.end, idx);
|
|
2542
|
+
if (ext > v.end)
|
|
2543
|
+
v.end = ext;
|
|
2544
|
+
}
|
|
2343
2545
|
if (!quoted) {
|
|
2344
2546
|
const trailing = trailingLabelStart(text, v.start, v.end, idx.tokenInner);
|
|
2345
2547
|
if (trailing > 0 && innerWordHasValue(text, v.start + trailing, idx)) {
|
|
@@ -2402,6 +2604,11 @@ function labelCandidates(S, pass, regions, out, blocks) {
|
|
|
2402
2604
|
const trailing = trailingLabelStart(text, v.start, end, idx.tokenInner);
|
|
2403
2605
|
if (trailing !== -1)
|
|
2404
2606
|
end = v.start + trailing;
|
|
2607
|
+
if (schemePass && schemeIsLabelValue(text, hit.index)) {
|
|
2608
|
+
push(v.start, Math.max(end, v.end), REDACTED_SECRET);
|
|
2609
|
+
re.lastIndex = quoted ? from : Math.max(end, v.end);
|
|
2610
|
+
continue;
|
|
2611
|
+
}
|
|
2405
2612
|
if (gluedToSingleUnit(v.start, hit.index, unitAt) || userinfoHostHidden(text, v.start, unitAt)) {
|
|
2406
2613
|
const cut = trailing !== -1 ? end : Math.max(end, v.end);
|
|
2407
2614
|
const schemeHit = ADDRESS_SCHEME_RE.exec(text.slice(v.start, v.start + 20))?.[0] ?? '';
|
|
@@ -2799,6 +3006,90 @@ function authParamEdits(text) {
|
|
|
2799
3006
|
}
|
|
2800
3007
|
return edits;
|
|
2801
3008
|
}
|
|
3009
|
+
const LITERAL_PROBE_WINDOW = 64;
|
|
3010
|
+
function gluedLiteralStart(word) {
|
|
3011
|
+
const n = word.length;
|
|
3012
|
+
if (n < PROSE_LITERAL_MIN_RUN + 2)
|
|
3013
|
+
return 0;
|
|
3014
|
+
const runFrom = new Int32Array(n + 1);
|
|
3015
|
+
let best = 0;
|
|
3016
|
+
let run = 0;
|
|
3017
|
+
for (let k = n - 1; k >= 0; k--) {
|
|
3018
|
+
if (isAlnumCode(word.charCodeAt(k))) {
|
|
3019
|
+
run++;
|
|
3020
|
+
if (run > best)
|
|
3021
|
+
best = run;
|
|
3022
|
+
}
|
|
3023
|
+
else
|
|
3024
|
+
run = 0;
|
|
3025
|
+
runFrom[k] = best;
|
|
3026
|
+
}
|
|
3027
|
+
for (let k = 1; k < n; k++) {
|
|
3028
|
+
const left = word.charCodeAt(k - 1);
|
|
3029
|
+
if ((left !== 0x5f && left !== 0x2d) || !isAlnumCode(word.charCodeAt(k)))
|
|
3030
|
+
continue;
|
|
3031
|
+
if ((runFrom[k] ?? 0) < PROSE_LITERAL_MIN_RUN)
|
|
3032
|
+
return 0;
|
|
3033
|
+
if (SECRET_LITERAL_RE.test(word.slice(k, k + LITERAL_PROBE_WINDOW)))
|
|
3034
|
+
return k;
|
|
3035
|
+
}
|
|
3036
|
+
return 0;
|
|
3037
|
+
}
|
|
3038
|
+
const OPAQUE_MIN_LENGTH = 24;
|
|
3039
|
+
const OPAQUE_MIN_ENTROPY = 3.5;
|
|
3040
|
+
const OPAQUE_MAX_AVG_SEGMENT = 2.5;
|
|
3041
|
+
const BASE64_FILE_SIGNATURES = ['iVBORw0KGgo', 'R0lGOD', 'UklGR', 'JVBERi0', 'UEsDB', 'H4sI', 'PHN2Zy', 'PD94bWwg', 'AAABAA'];
|
|
3042
|
+
const NON_SECRET_ID_PREFIXES = new Set(['toolu', 'srvtoolu', 'msg', 'msgbatch', 'req', 'file', 'chatcmpl', 'call', 'resp']);
|
|
3043
|
+
function isOpaqueWord(text, i, end) {
|
|
3044
|
+
if (end - i < OPAQUE_MIN_LENGTH)
|
|
3045
|
+
return false;
|
|
3046
|
+
const prev = text.charAt(i - 1);
|
|
3047
|
+
const next = text.charAt(end);
|
|
3048
|
+
if (prev === '+' || prev === '@' || next === '+' || next === '/' || next === '=' || next === '@')
|
|
3049
|
+
return false;
|
|
3050
|
+
if (next === '.' && isKeyWordChar(text.charCodeAt(end + 1)))
|
|
3051
|
+
return false;
|
|
3052
|
+
if (text.slice(Math.max(0, i - 7), i).toLowerCase() === 'base64,')
|
|
3053
|
+
return false;
|
|
3054
|
+
const word = text.slice(i, end);
|
|
3055
|
+
if (/^[0-9A-Fa-f_-]+$/.test(word) || /^sha(?:1|256|384|512)-/i.test(word))
|
|
3056
|
+
return false;
|
|
3057
|
+
if (BASE64_FILE_SIGNATURES.some((sig) => word.startsWith(sig)))
|
|
3058
|
+
return false;
|
|
3059
|
+
const typed = /^([a-z]+)[_-]/.exec(word);
|
|
3060
|
+
if (typed !== null && NON_SECRET_ID_PREFIXES.has(typed[1] ?? ''))
|
|
3061
|
+
return false;
|
|
3062
|
+
let upper = false;
|
|
3063
|
+
let lower = false;
|
|
3064
|
+
let digit = false;
|
|
3065
|
+
const counts = new Map();
|
|
3066
|
+
for (let k = 0; k < word.length; k++) {
|
|
3067
|
+
const c = word.charCodeAt(k);
|
|
3068
|
+
if (c >= 0x41 && c <= 0x5a)
|
|
3069
|
+
upper = true;
|
|
3070
|
+
else if (c >= 0x61 && c <= 0x7a)
|
|
3071
|
+
lower = true;
|
|
3072
|
+
else if (c >= 0x30 && c <= 0x39)
|
|
3073
|
+
digit = true;
|
|
3074
|
+
counts.set(c, (counts.get(c) ?? 0) + 1);
|
|
3075
|
+
}
|
|
3076
|
+
if (!upper || !lower || !digit)
|
|
3077
|
+
return false;
|
|
3078
|
+
let entropy = 0;
|
|
3079
|
+
for (const n of counts.values()) {
|
|
3080
|
+
const p = n / word.length;
|
|
3081
|
+
entropy -= p * Math.log2(p);
|
|
3082
|
+
}
|
|
3083
|
+
if (entropy < OPAQUE_MIN_ENTROPY)
|
|
3084
|
+
return false;
|
|
3085
|
+
let segments = 0;
|
|
3086
|
+
let segmentChars = 0;
|
|
3087
|
+
for (const m of word.matchAll(/[A-Z]?[a-z]+|[A-Z]+(?![a-z])|[0-9]+/g)) {
|
|
3088
|
+
segments++;
|
|
3089
|
+
segmentChars += m[0].length;
|
|
3090
|
+
}
|
|
3091
|
+
return segments > 0 && segmentChars / segments <= OPAQUE_MAX_AVG_SEGMENT;
|
|
3092
|
+
}
|
|
2802
3093
|
function proseLiteralEdits(text) {
|
|
2803
3094
|
const edits = [];
|
|
2804
3095
|
let i = 0;
|
|
@@ -2833,6 +3124,13 @@ function proseLiteralEdits(text) {
|
|
|
2833
3124
|
if (!pathish && SECRET_LITERAL_RE.test(word) && longestAlnumRun(word) >= PROSE_LITERAL_MIN_RUN) {
|
|
2834
3125
|
pushEdit(edits, text, i, end, REDACTED_SECRET);
|
|
2835
3126
|
}
|
|
3127
|
+
else if (!pathish) {
|
|
3128
|
+
const glued = gluedLiteralStart(word);
|
|
3129
|
+
if (glued > 0)
|
|
3130
|
+
pushEdit(edits, text, i + glued, end, REDACTED_SECRET);
|
|
3131
|
+
else if (!hostSlot && isOpaqueWord(text, i, end))
|
|
3132
|
+
pushEdit(edits, text, i, end, REDACTED_SECRET);
|
|
3133
|
+
}
|
|
2836
3134
|
i = end;
|
|
2837
3135
|
}
|
|
2838
3136
|
return edits;
|
|
@@ -4081,6 +4379,10 @@ export function displayUntrusted(text, opts = {}) {
|
|
|
4081
4379
|
const out = renderUntrusted(text, opts, null);
|
|
4082
4380
|
return typeof out === 'string' ? out : out.text;
|
|
4083
4381
|
}
|
|
4382
|
+
export function quoteUntrustedForSentence(text, max) {
|
|
4383
|
+
const shown = displayUntrusted(text, { max, blanks: true, escapeBackslashes: true });
|
|
4384
|
+
return shown.trim() === '' ? undefined : `"${shown.replace(/"/g, '\\"')}"`;
|
|
4385
|
+
}
|
|
4084
4386
|
export function displayUntrustedMarks(text, opts = {}) {
|
|
4085
4387
|
const ledger = { cps: [], lens: [] };
|
|
4086
4388
|
const out = renderUntrusted(text, opts, ledger);
|
|
@@ -4088,4 +4390,4 @@ export function displayUntrustedMarks(text, opts = {}) {
|
|
|
4088
4390
|
return { text: out, marks: [] };
|
|
4089
4391
|
return { text: out.text, marks: collectMarks(out, ledger) };
|
|
4090
4392
|
}
|
|
4091
|
-
const isQuoteChar = (c) => c.charCodeAt(0) === 0x22 || c.charCodeAt(0) === 0x27
|
|
4393
|
+
const isQuoteChar = (c) => c.charCodeAt(0) === 0x22 || c.charCodeAt(0) === 0x27;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type EngineAgentPanelAbsence, type EngineAgentPanelCycleIdentity, type EngineAgentPanelEvent } from './engineAgentPanelStore.js';
|
|
2
|
-
import type {
|
|
2
|
+
import type { CcTaskTerminalStatus } from './terminalStatuses.js';
|
|
3
3
|
export declare const ENGINE_AGENT_ABSENT_ROW_TEXT = "engine no longer reports this agent \u00B7 it may still be running";
|
|
4
4
|
export declare const ENGINE_AGENT_ABSENCE_TTL_MS: number;
|
|
5
5
|
export type EngineAgentAbsenceMark = Readonly<Pick<EngineAgentPanelAbsence, 'lastSeenAtMs' | 'absentForMs'>>;
|
|
@@ -48,7 +48,7 @@ export interface EngineAgentAbsenceReapOptions {
|
|
|
48
48
|
}
|
|
49
49
|
export declare function reapEngineAgentAbsentRows(rows: Readonly<Record<string, EngineAgentAbsenceReapRow | null | undefined>>, opts: EngineAgentAbsenceReapOptions): EngineAgentAbsenceReap;
|
|
50
50
|
export declare function engineAgentAbsenceDroppedLine(label: string, ttlMs?: number, removeReason?: string | null): string;
|
|
51
|
-
export declare function engineAgentTerminalAfterDropLine(label: string, status:
|
|
51
|
+
export declare function engineAgentTerminalAfterDropLine(label: string, status: CcTaskTerminalStatus, hasReport: boolean): string;
|
|
52
52
|
export interface EngineAgentRegistryRowView {
|
|
53
53
|
readonly id: string;
|
|
54
54
|
readonly type: string;
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import { isNewEngineAgentPanelCycle, isStaleEngineAgentPanelEnd, MAX_HELD_WIRE_TICK_BEATS, type EnginePanelTaskIdentity, type PanelDelta } from './panelReduce.js';
|
|
2
|
+
import type { EngineAgentPanelCycleIdentity } from './cycleOrder.js';
|
|
3
|
+
export { isNewEngineAgentPanelCycle, isStaleEngineAgentPanelEnd, MAX_HELD_WIRE_TICK_BEATS };
|
|
4
|
+
export type { EngineAgentPanelCycleIdentity, EnginePanelTaskIdentity };
|
|
1
5
|
export type EngineAgentPanelEvent = {
|
|
2
6
|
kind: 'tick';
|
|
3
7
|
taskId: string;
|
|
@@ -45,33 +49,19 @@ export declare const PANEL_TOOLUSES_LANE_POLICY: Readonly<Record<'tick' | 'fleet
|
|
|
45
49
|
export declare function markEnginePanelTaskResident(taskId: string): void;
|
|
46
50
|
export declare function clearEnginePanelTaskResident(taskId: string): void;
|
|
47
51
|
export declare function isEnginePanelTaskResident(taskId: string): boolean;
|
|
48
|
-
type Listener = (ev: EngineAgentPanelEvent) => void;
|
|
49
|
-
export declare function isNewEngineAgentPanelCycle(prev: EngineAgentPanelCycleIdentity | null | undefined, next: EngineAgentPanelCycleIdentity | null | undefined): boolean;
|
|
50
|
-
export interface EngineAgentPanelCycleIdentity {
|
|
51
|
-
readonly cycleSeq?: number;
|
|
52
|
-
readonly startedAt?: number;
|
|
53
|
-
}
|
|
54
|
-
export declare function isStaleEngineAgentPanelEnd(end: EngineAgentPanelCycleIdentity | null | undefined, current: EngineAgentPanelCycleIdentity | null | undefined): boolean;
|
|
55
|
-
export declare const MAX_HELD_WIRE_TICK_BEATS = 16;
|
|
56
|
-
export interface EnginePanelTaskIdentity {
|
|
57
|
-
readonly taskId: string;
|
|
58
|
-
readonly origin: 'fleet-row' | 'wire';
|
|
59
|
-
readonly cycleSeq?: number;
|
|
60
|
-
readonly startedAt?: number;
|
|
61
|
-
}
|
|
62
52
|
export declare function resolveEnginePanelTaskId(wireTaskId: string, parentToolCallId?: string): EnginePanelTaskIdentity;
|
|
63
53
|
export declare function clearEnginePanelTaskResidentByWire(wireTaskId: string, cycle?: EngineAgentPanelCycleIdentity): void;
|
|
64
54
|
export declare function __resetEngineAgentPanelIdentityForTests(): void;
|
|
55
|
+
export declare function __resetEnginePanelStateForTests(): void;
|
|
65
56
|
export declare function publishEngineAgentPanelEvent(ev: EngineAgentPanelEvent): void;
|
|
66
|
-
export declare function subscribeEngineAgentPanel(fn:
|
|
57
|
+
export declare function subscribeEngineAgentPanel(fn: (ev: EngineAgentPanelEvent) => void): () => void;
|
|
58
|
+
export declare function subscribeEnginePanelRows(fn: (delta: PanelDelta) => void): () => void;
|
|
67
59
|
export interface EngineAgentPanelAbsence {
|
|
68
60
|
taskId: string;
|
|
69
61
|
lastSeenAtMs: number;
|
|
70
62
|
absentForMs: number;
|
|
71
63
|
wireTaskId?: string;
|
|
72
64
|
}
|
|
73
|
-
type AbsenceListener = (ev: EngineAgentPanelAbsence) => void;
|
|
74
65
|
export declare function publishEngineAgentPanelAbsence(ev: EngineAgentPanelAbsence): void;
|
|
75
|
-
export declare function subscribeEngineAgentPanelAbsence(fn:
|
|
66
|
+
export declare function subscribeEngineAgentPanelAbsence(fn: (ev: EngineAgentPanelAbsence) => void): () => void;
|
|
76
67
|
export declare function __resetEngineAgentPanelAbsenceForTests(): void;
|
|
77
|
-
export {};
|