@sema-agent/client-core 0.95.0 → 0.97.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 +269 -0
- package/README.md +61 -31
- package/dist/adapt/arms.js +7 -1
- package/dist/adapt/toolCards.d.ts +1 -0
- package/dist/adapt/toolCards.js +16 -3
- package/dist/adapt/wireShapes.js +2 -16
- package/dist/adapter/activeRunSelfHeal.d.ts +4 -2
- package/dist/adapter/activeRunSelfHeal.js +32 -6
- package/dist/adapter/downstream/eventToSdkMessage.js +11 -3
- package/dist/adapter/downstream/terminalToSdkResult.js +14 -11
- package/dist/adapter/runStream.js +30 -47
- package/dist/agentSession/backgroundView.js +2 -15
- package/dist/agentSession/engineAgentRegistryRead.js +5 -4
- package/dist/agentSession/engineSessionBackgroundStop.js +22 -15
- package/dist/agentsWireCaps.d.ts +1 -1
- package/dist/agentsWireCaps.js +29 -12
- package/dist/approvalDecidedByCapability.d.ts +2 -0
- package/dist/approvalDecidedByCapability.js +0 -1
- package/dist/approvalsStreamLiveCapability.d.ts +2 -0
- package/dist/approvalsStreamLiveCapability.js +3 -2
- package/dist/attachmentSeatCapability.d.ts +2 -0
- package/dist/attachmentSeatCapability.js +0 -1
- package/dist/callerCwdCapability.d.ts +2 -4
- package/dist/callerCwdCapability.js +0 -7
- package/dist/centerWiringCapability.d.ts +2 -4
- package/dist/centerWiringCapability.js +4 -9
- package/dist/classifierVerdictWire.js +4 -16
- package/dist/clientSlice.js +1 -1
- package/dist/cloudConfigWireCaps.d.ts +4 -4
- package/dist/cloudConfigWireCaps.js +241 -85
- package/dist/coreValuePorts.d.ts +11 -7
- package/dist/coreValuePorts.js +5 -8
- package/dist/credentialProvenance.d.ts +28 -0
- package/dist/credentialProvenance.js +76 -0
- package/dist/decideFailureNote.js +3 -1
- package/dist/decideReceipt.js +7 -10
- package/dist/declared/supportFloorDeclared.js +3 -3
- package/dist/deviceExecutorManagementCapability.d.ts +2 -0
- package/dist/deviceExecutorManagementCapability.js +3 -2
- package/dist/displayUntrusted.d.ts +10 -3
- package/dist/displayUntrusted.js +371 -60
- package/dist/engineCapReader.d.ts +8 -2
- package/dist/engineCapReader.js +15 -7
- package/dist/engineCapsCache.d.ts +17 -3
- package/dist/engineCapsCache.js +268 -43
- package/dist/engineDirectory.d.ts +79 -0
- package/dist/engineDirectory.js +186 -0
- package/dist/engineErrorCodes.d.ts +17 -1
- package/dist/engineErrorCodes.js +46 -16
- package/dist/engineNoticeCodes.d.ts +17 -0
- package/dist/engineNoticeCodes.js +54 -1
- package/dist/executionLaneCapability.d.ts +2 -0
- package/dist/executionLaneCapability.js +3 -2
- package/dist/fileHistoryCaptureCapability.d.ts +16 -0
- package/dist/fileHistoryCaptureCapability.js +98 -2
- package/dist/fileHistoryLegNotice.js +4 -0
- package/dist/fleet/bgSubagentRow.d.ts +15 -0
- package/dist/fleet/bgSubagentRow.js +67 -0
- package/dist/fleet/fleetLedger.d.ts +1 -0
- package/dist/fleet/fleetLedger.js +164 -126
- package/dist/fleet/fleetProjection.d.ts +1 -0
- package/dist/fleet/fleetProjection.js +10 -3
- package/dist/fleetTaskDesc.js +4 -17
- package/dist/gateOutcome.d.ts +12 -1
- package/dist/gateOutcome.js +56 -1
- package/dist/gateVocabulary.d.ts +2 -2
- package/dist/gateVocabulary.js +4 -3
- package/dist/generated/engineAskFaceTables.js +1 -1
- package/dist/generated/engineFactTables.d.ts +5 -3
- package/dist/generated/engineFactTables.js +17 -4
- package/dist/generated/engineNoticeTables.js +12 -3
- package/dist/generated/sdkFactTables.d.ts +2 -0
- package/dist/generated/sdkFactTables.js +7 -0
- package/dist/generated/settingsSchemaFns.d.ts +3 -0
- package/dist/generated/settingsSchemaFns.js +53 -0
- package/dist/generated/toolNameTables.d.ts +1 -1
- package/dist/generated/toolNameTables.js +1 -42
- package/dist/hitl/approvalDecisionNoteAudit.js +2 -2
- package/dist/hitl/approvalEndingCause.d.ts +2 -0
- package/dist/hitl/approvalEndingCause.js +26 -21
- package/dist/hitl/approvalHolds.d.ts +16 -1
- package/dist/hitl/approvalHolds.js +52 -12
- package/dist/hitl/askGateWire.js +1 -0
- package/dist/hitl/askParkRowRouting.js +1 -1
- package/dist/hitl/automaticAnswerVerdict.d.ts +1 -1
- package/dist/hitl/automaticAnswerVerdict.js +13 -10
- package/dist/hitl/decisionConflict.js +4 -5
- package/dist/hitl/decisionRefusal.d.ts +8 -0
- package/dist/hitl/decisionRefusal.js +55 -14
- package/dist/hitl/frameRouter.d.ts +3 -1
- package/dist/hitl/frameRouter.js +58 -39
- package/dist/hitl/gateLedger.d.ts +0 -5
- package/dist/hitl/gateLedger.js +0 -21
- package/dist/hitl/hitlBridge.d.ts +6 -2
- package/dist/hitl/hitlBridge.js +46 -11
- package/dist/hitl/localAllowRule.d.ts +1 -0
- package/dist/hitl/localAllowRule.js +2 -2
- package/dist/hitl/noAllowCause.d.ts +2 -1
- package/dist/hitl/noAllowCause.js +3 -2
- package/dist/hitl/parkResolver.d.ts +1 -0
- package/dist/hitl/parkResolver.js +14 -56
- package/dist/hitl/parkRowBirthWait.d.ts +1 -0
- package/dist/hitl/parkRowBirthWait.js +2 -2
- package/dist/hitl/planReviewWire.d.ts +1 -0
- package/dist/hitl/planReviewWire.js +98 -20
- package/dist/hitl/replayedApproval.d.ts +3 -3
- package/dist/hitl/replayedApproval.js +21 -16
- package/dist/hitl/sessionPolicyDeliverable.d.ts +0 -1
- package/dist/hitl/sessionPolicyDeliverable.js +17 -17
- package/dist/hitl/sessionPolicyWire.d.ts +2 -0
- package/dist/hitl/sessionPolicyWire.js +15 -3
- package/dist/hitl/standingRows.d.ts +19 -0
- package/dist/hitl/standingRows.js +148 -0
- package/dist/hitl/suspendedReopen.js +2 -1
- package/dist/hitl/toolApprovalWire.d.ts +22 -10
- package/dist/hitl/toolApprovalWire.js +286 -47
- package/dist/hookMatcherVerdict.d.ts +1 -9
- package/dist/hookMatcherVerdict.js +21 -61
- package/dist/hooksWireCaps.js +2 -2
- package/dist/hostCallbackGuard.d.ts +1 -0
- package/dist/hostCallbackGuard.js +6 -0
- package/dist/index.d.ts +26 -12
- package/dist/index.js +20 -10
- package/dist/liveModelCatalog.d.ts +13 -0
- package/dist/liveModelCatalog.js +56 -0
- package/dist/mcpProbeCapability.d.ts +2 -4
- package/dist/mcpProbeCapability.js +3 -8
- package/dist/mcpWireCaps.d.ts +1 -0
- package/dist/mcpWireCaps.js +4 -1
- package/dist/memoryComplianceCapability.d.ts +2 -4
- package/dist/memoryComplianceCapability.js +3 -8
- package/dist/memoryOriginCapability.d.ts +2 -4
- package/dist/memoryOriginCapability.js +3 -8
- package/dist/memorySpecWire.js +2 -2
- package/dist/modelIdentityResolvability.d.ts +2 -2
- package/dist/modelIdentityResolvability.js +14 -5
- package/dist/noticePresentation.d.ts +68 -0
- package/dist/noticePresentation.js +247 -0
- package/dist/outputStyleSeatCapability.d.ts +2 -1
- package/dist/outputStyleSeatCapability.js +0 -4
- package/dist/ownKey.d.ts +2 -0
- package/dist/ownKey.js +18 -0
- package/dist/peerFrames.js +13 -9
- package/dist/peerLaneCapability.d.ts +2 -0
- package/dist/peerLaneCapability.js +3 -2
- package/dist/permissionModesCapability.d.ts +2 -4
- package/dist/permissionModesCapability.js +0 -7
- package/dist/permissionRuleIssue.js +0 -3
- package/dist/permissionRulesWriteCapability.d.ts +2 -0
- package/dist/permissionRulesWriteCapability.js +3 -2
- package/dist/permissionsAllowGrantCapability.d.ts +2 -0
- package/dist/permissionsAllowGrantCapability.js +4 -2
- package/dist/permissionsDeclaration.d.ts +2 -0
- package/dist/permissionsDeclaration.js +72 -59
- package/dist/printPermissionOutcome.d.ts +12 -0
- package/dist/printPermissionOutcome.js +50 -0
- package/dist/printToolResultFrame.d.ts +1 -0
- package/dist/printToolResultFrame.js +5 -9
- package/dist/promptBlockedCopy.d.ts +5 -0
- package/dist/promptBlockedCopy.js +35 -0
- package/dist/protocolSegment.d.ts +9 -6
- package/dist/protocolSegment.js +31 -21
- package/dist/providerRejection.d.ts +4 -0
- package/dist/providerRejection.js +75 -14
- package/dist/replayBody.d.ts +12 -0
- package/dist/replayBody.js +25 -0
- package/dist/request/taskRequest.d.ts +1 -4
- package/dist/request/taskRequest.js +74 -19
- package/dist/resumeRefusalCopy.js +9 -25
- package/dist/retryStatus.d.ts +9 -1
- package/dist/retryStatus.js +9 -2
- package/dist/rewindArchiveCapability.d.ts +3 -13
- package/dist/rewindArchiveCapability.js +12 -58
- package/dist/rewindArchiveReading.d.ts +17 -0
- package/dist/rewindArchiveReading.js +55 -0
- package/dist/ruleCompileVerdict.d.ts +9 -1
- package/dist/ruleCompileVerdict.js +29 -4
- package/dist/runTerminal.d.ts +48 -5
- package/dist/runTerminal.js +215 -12
- package/dist/sandboxWire.js +13 -0
- package/dist/sdkWireTransit.d.ts +2 -1
- package/dist/sdkWireTransit.js +1 -0
- package/dist/sealedKeyCapability.d.ts +2 -4
- package/dist/sealedKeyCapability.js +0 -7
- package/dist/seam.js +4 -2
- package/dist/seatContract.d.ts +76 -11
- package/dist/seatContract.js +222 -27
- package/dist/sessionPolicyCapability.d.ts +2 -0
- package/dist/sessionPolicyCapability.js +3 -2
- package/dist/sessionReadRedactionCapability.d.ts +2 -4
- package/dist/sessionReadRedactionCapability.js +0 -7
- package/dist/sessionSyncFileHistory.d.ts +4 -0
- package/dist/sessionSyncFileHistory.js +66 -0
- package/dist/sessionSyncFileHistoryCapability.d.ts +2 -1
- package/dist/sessionSyncFileHistoryCapability.js +3 -5
- package/dist/skillToolListsCapability.d.ts +2 -1
- package/dist/skillToolListsCapability.js +3 -5
- package/dist/sqlEngineCapability.d.ts +2 -0
- package/dist/sqlEngineCapability.js +4 -3
- package/dist/steerPriorityCapability.d.ts +2 -1
- package/dist/steerPriorityCapability.js +3 -5
- package/dist/storePostureCapability.d.ts +2 -4
- package/dist/storePostureCapability.js +4 -9
- package/dist/subagent/engineSubagentSteer.js +7 -5
- package/dist/subagentContentStore.js +4 -15
- package/dist/supportFloor.d.ts +1 -0
- package/dist/supportFloor.js +13 -9
- package/dist/systemReminderTag.d.ts +1 -0
- package/dist/systemReminderTag.js +8 -0
- package/dist/toolHistoryBadTurn.js +3 -2
- package/dist/toolHistoryMismatch.d.ts +0 -3
- package/dist/toolHistoryMismatch.js +3 -7
- package/dist/toolResult.d.ts +12 -1
- package/dist/toolResult.js +55 -1
- package/dist/toolResultContent.d.ts +2 -0
- package/dist/toolResultContent.js +63 -0
- package/dist/usageAnalytics.js +40 -16
- package/dist/userInvokedSkillsCapability.d.ts +2 -1
- package/dist/userInvokedSkillsCapability.js +3 -5
- package/dist/webSearchBackendCapability.d.ts +2 -0
- package/dist/webSearchBackendCapability.js +3 -2
- package/dist/wireErrorTriage.d.ts +2 -0
- package/dist/wireErrorTriage.js +91 -38
- package/dist/wireFailureShape.d.ts +20 -3
- package/dist/wireFailureShape.js +128 -72
- package/dist/workflowsJournalCapability.d.ts +2 -0
- package/dist/workflowsJournalCapability.js +3 -2
- package/dist/writeProtectionCapability.d.ts +2 -0
- package/dist/writeProtectionCapability.js +3 -2
- package/docs/INTEGRATION-CLIENTS.md +1784 -20
- package/package.json +5 -5
- package/dist/engineRefusedToolName.d.ts +0 -1
- package/dist/engineRefusedToolName.js +0 -8
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export type RewindArchiveBit = 'on' | 'off' | 'not_reported' | 'malformed';
|
|
2
|
+
export type RewindArchiveReading = {
|
|
3
|
+
kind: 'unobserved';
|
|
4
|
+
} | {
|
|
5
|
+
kind: 'unreadable';
|
|
6
|
+
} | {
|
|
7
|
+
kind: 'present';
|
|
8
|
+
conversationAnchor: RewindArchiveBit;
|
|
9
|
+
forkRestore: RewindArchiveBit;
|
|
10
|
+
codeOnly: RewindArchiveBit;
|
|
11
|
+
restoreFilesEpoch: RewindArchiveBit;
|
|
12
|
+
};
|
|
13
|
+
export type RewindCodeArchive = 'available' | 'unavailable' | 'unknown';
|
|
14
|
+
export declare function projectRewindArchiveCapability(caps: unknown): RewindArchiveReading | undefined;
|
|
15
|
+
export declare function rewindArchiveReadingAt(baseUrl: string | undefined): RewindArchiveReading;
|
|
16
|
+
export declare function resetRewindArchiveReader(): void;
|
|
17
|
+
export declare function rewindConversationAvailability(reading: RewindArchiveReading): RewindCodeArchive;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { createEngineCapReader } from './engineCapReader.js';
|
|
2
|
+
import { ownDataField } from './ownKey.js';
|
|
3
|
+
const CAPS_KEYS = {
|
|
4
|
+
conversationAnchor: 'resumeAt',
|
|
5
|
+
forkRestore: 'rewindFiles',
|
|
6
|
+
codeOnly: 'rewindFilesTo',
|
|
7
|
+
restoreFilesEpoch: 'restoreFiles',
|
|
8
|
+
};
|
|
9
|
+
const _capsKeyPin = true;
|
|
10
|
+
void _capsKeyPin;
|
|
11
|
+
function bitOf(caps, key) {
|
|
12
|
+
const v = ownDataField(caps, key);
|
|
13
|
+
if (v === undefined)
|
|
14
|
+
return 'not_reported';
|
|
15
|
+
if (v === true)
|
|
16
|
+
return 'on';
|
|
17
|
+
if (v === false)
|
|
18
|
+
return 'off';
|
|
19
|
+
return 'malformed';
|
|
20
|
+
}
|
|
21
|
+
export function projectRewindArchiveCapability(caps) {
|
|
22
|
+
try {
|
|
23
|
+
if (caps === null || typeof caps !== 'object' || Array.isArray(caps))
|
|
24
|
+
return undefined;
|
|
25
|
+
return {
|
|
26
|
+
kind: 'present',
|
|
27
|
+
conversationAnchor: bitOf(caps, CAPS_KEYS.conversationAnchor),
|
|
28
|
+
forkRestore: bitOf(caps, CAPS_KEYS.forkRestore),
|
|
29
|
+
codeOnly: bitOf(caps, CAPS_KEYS.codeOnly),
|
|
30
|
+
restoreFilesEpoch: bitOf(caps, CAPS_KEYS.restoreFilesEpoch),
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
catch {
|
|
34
|
+
return undefined;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
const reader = createEngineCapReader({
|
|
38
|
+
name: 'rewindArchive',
|
|
39
|
+
project: projectRewindArchiveCapability,
|
|
40
|
+
});
|
|
41
|
+
export function rewindArchiveReadingAt(baseUrl) {
|
|
42
|
+
return reader.observed(baseUrl);
|
|
43
|
+
}
|
|
44
|
+
export function resetRewindArchiveReader() {
|
|
45
|
+
reader.__resetForTests();
|
|
46
|
+
}
|
|
47
|
+
export function rewindConversationAvailability(reading) {
|
|
48
|
+
if (reading.kind !== 'present')
|
|
49
|
+
return 'unknown';
|
|
50
|
+
if (reading.conversationAnchor === 'on')
|
|
51
|
+
return 'available';
|
|
52
|
+
if (reading.conversationAnchor === 'off')
|
|
53
|
+
return 'unavailable';
|
|
54
|
+
return 'unknown';
|
|
55
|
+
}
|
|
@@ -1,2 +1,10 @@
|
|
|
1
|
-
export type RuleCompileVerdict =
|
|
1
|
+
export type RuleCompileVerdict = {
|
|
2
|
+
readonly kind: 'compiles';
|
|
3
|
+
} | {
|
|
4
|
+
readonly kind: 'refused';
|
|
5
|
+
readonly code?: string;
|
|
6
|
+
readonly message?: string;
|
|
7
|
+
} | {
|
|
8
|
+
readonly kind: 'unknown';
|
|
9
|
+
};
|
|
2
10
|
export declare function ruleCompileVerdict(rule: string, behavior: 'deny' | 'ask'): RuleCompileVerdict;
|
|
@@ -1,13 +1,38 @@
|
|
|
1
1
|
import { validatePermissionRules } from './coreValuePorts.js';
|
|
2
2
|
const RULE_COMPILE_ROOT = '/';
|
|
3
|
+
function issueText(issue, key) {
|
|
4
|
+
try {
|
|
5
|
+
if (typeof issue !== 'object' || issue === null || !Object.hasOwn(issue, key))
|
|
6
|
+
return undefined;
|
|
7
|
+
const v = issue[key];
|
|
8
|
+
return typeof v === 'string' && v.length > 0 ? v : undefined;
|
|
9
|
+
}
|
|
10
|
+
catch {
|
|
11
|
+
return undefined;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
function firstIssue(issues) {
|
|
15
|
+
try {
|
|
16
|
+
return issues[0];
|
|
17
|
+
}
|
|
18
|
+
catch {
|
|
19
|
+
return undefined;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
3
22
|
export function ruleCompileVerdict(rule, behavior) {
|
|
23
|
+
let issues;
|
|
4
24
|
try {
|
|
5
|
-
|
|
25
|
+
issues = validatePermissionRules([{ rule, behavior }], { pathBases: { root: RULE_COMPILE_ROOT } });
|
|
6
26
|
if (!Array.isArray(issues))
|
|
7
|
-
return 'unknown';
|
|
8
|
-
|
|
27
|
+
return { kind: 'unknown' };
|
|
28
|
+
if (issues.length === 0)
|
|
29
|
+
return { kind: 'compiles' };
|
|
9
30
|
}
|
|
10
31
|
catch {
|
|
11
|
-
return 'unknown';
|
|
32
|
+
return { kind: 'unknown' };
|
|
12
33
|
}
|
|
34
|
+
const issue = firstIssue(issues);
|
|
35
|
+
const code = issueText(issue, 'code');
|
|
36
|
+
const message = issueText(issue, 'message');
|
|
37
|
+
return { kind: 'refused', ...(code !== undefined ? { code } : {}), ...(message !== undefined ? { message } : {}) };
|
|
13
38
|
}
|
package/dist/runTerminal.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CheckpointGate } from '@sema-agent/sdk';
|
|
1
|
+
import type { CheckpointGate, TerminalModelOutputInvalidDetail } from '@sema-agent/sdk';
|
|
2
2
|
export type RunTerminalPlane = 'cause' | 'flat';
|
|
3
3
|
export interface RunTerminalPause {
|
|
4
4
|
gate?: CheckpointGate;
|
|
@@ -11,11 +11,49 @@ export interface RunTerminalPausedRead extends RunTerminalPause {
|
|
|
11
11
|
code?: string;
|
|
12
12
|
flatStatus?: string;
|
|
13
13
|
}
|
|
14
|
-
export
|
|
15
|
-
kind:
|
|
16
|
-
|
|
14
|
+
export type RunTerminalFailureDetail = RunTerminalProviderRejectedDetail | {
|
|
15
|
+
kind: 'coded';
|
|
16
|
+
detail: {
|
|
17
|
+
readonly [key: string]: RunTerminalJsonValue;
|
|
18
|
+
};
|
|
19
|
+
} | {
|
|
20
|
+
kind: 'model_output_invalid';
|
|
21
|
+
cause: TerminalModelOutputInvalidDetail['cause'];
|
|
22
|
+
outputLimit?: RunTerminalOutputLimit;
|
|
23
|
+
} | {
|
|
24
|
+
kind: 'unrecognized';
|
|
25
|
+
word: string;
|
|
26
|
+
};
|
|
27
|
+
export type RunTerminalJsonValue = string | number | boolean | null | readonly RunTerminalJsonValue[] | {
|
|
28
|
+
readonly [key: string]: RunTerminalJsonValue;
|
|
29
|
+
};
|
|
30
|
+
export interface RunTerminalOutputLimit {
|
|
31
|
+
capStop: boolean;
|
|
32
|
+
outputTokens?: number;
|
|
33
|
+
capTokens?: number;
|
|
34
|
+
}
|
|
35
|
+
export interface RunTerminalProviderRejectedDetail {
|
|
36
|
+
kind: 'provider_rejected';
|
|
37
|
+
status: number;
|
|
17
38
|
code?: string;
|
|
39
|
+
providerCondition?: string;
|
|
40
|
+
providerConditionSource?: string;
|
|
41
|
+
providerResetAtMs?: number;
|
|
42
|
+
route?: RunTerminalRequestRoute;
|
|
18
43
|
}
|
|
44
|
+
export interface RunTerminalRequestRoute {
|
|
45
|
+
credentialSource: string;
|
|
46
|
+
carrier?: string;
|
|
47
|
+
carrierBag?: string;
|
|
48
|
+
root: string;
|
|
49
|
+
}
|
|
50
|
+
export type RunTerminalCompletedDetail = {
|
|
51
|
+
kind: 'finish_reason_unknown';
|
|
52
|
+
finishReasonUnknown: string;
|
|
53
|
+
} | {
|
|
54
|
+
kind: 'unrecognized';
|
|
55
|
+
word: string;
|
|
56
|
+
};
|
|
19
57
|
export declare const PROMPT_BLOCK_CAUSES: readonly ["block", "crashed", "timeout", "cancelled"];
|
|
20
58
|
export type PromptBlockCause = (typeof PROMPT_BLOCK_CAUSES)[number];
|
|
21
59
|
export type RunTerminalBlockedDetail = {
|
|
@@ -31,9 +69,13 @@ export type RunTerminalBlockedDetail = {
|
|
|
31
69
|
kind: 'unrecognized';
|
|
32
70
|
word: string;
|
|
33
71
|
};
|
|
34
|
-
export type RunTerminalRead = {
|
|
72
|
+
export type RunTerminalRead = RunTerminalReadArm & {
|
|
73
|
+
readonly replay?: true;
|
|
74
|
+
};
|
|
75
|
+
type RunTerminalReadArm = {
|
|
35
76
|
kind: 'completed';
|
|
36
77
|
plane: RunTerminalPlane;
|
|
78
|
+
detail?: RunTerminalCompletedDetail;
|
|
37
79
|
} | {
|
|
38
80
|
kind: 'failed';
|
|
39
81
|
plane: RunTerminalPlane;
|
|
@@ -60,3 +102,4 @@ export declare function runTerminalGateKind(read: RunTerminalRead | null): strin
|
|
|
60
102
|
export declare function runTerminalGateToolName(read: RunTerminalRead | null): string | undefined;
|
|
61
103
|
export declare function runTerminalCode(read: RunTerminalRead | null): string | undefined;
|
|
62
104
|
export declare function isReviewPark(read: RunTerminalRead | null): boolean;
|
|
105
|
+
export {};
|
package/dist/runTerminal.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { CORE_PROMPT_BLOCK_CAUSES } from './generated/engineFactTables.js';
|
|
2
2
|
import { isSdkRunParked } from './terminalStatuses.js';
|
|
3
|
+
import { readOwnDataNonEmptyString, readOwnDataValue } from './ownKey.js';
|
|
4
|
+
import { doneResultView } from './replayBody.js';
|
|
3
5
|
export const PROMPT_BLOCK_CAUSES = CORE_PROMPT_BLOCK_CAUSES;
|
|
4
6
|
const PROMPT_BLOCKED_BY_HOOK_DETAIL_KIND = 'prompt_blocked_by_hook';
|
|
5
7
|
function str(v) {
|
|
@@ -27,6 +29,123 @@ function ownValueOf(o, k) {
|
|
|
27
29
|
return Object.prototype.hasOwnProperty.call(o, k) ? o[k] : undefined;
|
|
28
30
|
}
|
|
29
31
|
const PROVIDER_REJECTED_DETAIL_KIND = 'provider_rejected';
|
|
32
|
+
const CODED_DETAIL_KIND = 'coded';
|
|
33
|
+
const MODEL_OUTPUT_INVALID_DETAIL_KIND = 'model_output_invalid';
|
|
34
|
+
const MODEL_OUTPUT_INVALID_CAUSES = Object.freeze(['truncated', 'unnamed']);
|
|
35
|
+
const _modelOutputInvalidCausePin = [true, true];
|
|
36
|
+
void _modelOutputInvalidCausePin;
|
|
37
|
+
const CODED_DETAIL_MAX_DEPTH = 40;
|
|
38
|
+
function ownData(o, k) {
|
|
39
|
+
const d = Object.getOwnPropertyDescriptor(o, k);
|
|
40
|
+
return d !== undefined && 'value' in d ? d.value : undefined;
|
|
41
|
+
}
|
|
42
|
+
function isPlainRecord(v) {
|
|
43
|
+
if (typeof v !== 'object' || v === null || Array.isArray(v))
|
|
44
|
+
return false;
|
|
45
|
+
const proto = Object.getPrototypeOf(v);
|
|
46
|
+
return proto === null || Object.getPrototypeOf(proto) === null;
|
|
47
|
+
}
|
|
48
|
+
const CODED_DETAIL_BUDGET = 50_000;
|
|
49
|
+
const CODED_DETAIL_OVER_BUDGET = Symbol('coded-detail-over-budget');
|
|
50
|
+
function jsonSnapshot(v, depth, ctx) {
|
|
51
|
+
ctx.budget -= 1;
|
|
52
|
+
if (ctx.budget < 0)
|
|
53
|
+
throw CODED_DETAIL_OVER_BUDGET;
|
|
54
|
+
if (v === null || typeof v === 'string' || typeof v === 'boolean')
|
|
55
|
+
return v;
|
|
56
|
+
if (typeof v === 'number')
|
|
57
|
+
return Number.isFinite(v) ? v : undefined;
|
|
58
|
+
if (depth >= CODED_DETAIL_MAX_DEPTH)
|
|
59
|
+
return undefined;
|
|
60
|
+
if (typeof v !== 'object' || ctx.path.has(v))
|
|
61
|
+
return undefined;
|
|
62
|
+
if (Array.isArray(v)) {
|
|
63
|
+
const n = ownData(v, 'length');
|
|
64
|
+
if (typeof n !== 'number' || !Number.isSafeInteger(n) || n < 0)
|
|
65
|
+
return undefined;
|
|
66
|
+
ctx.path.add(v);
|
|
67
|
+
try {
|
|
68
|
+
const out = [];
|
|
69
|
+
for (let i = 0; i < n; i += 1) {
|
|
70
|
+
ctx.budget -= 1;
|
|
71
|
+
if (ctx.budget < 0)
|
|
72
|
+
throw CODED_DETAIL_OVER_BUDGET;
|
|
73
|
+
let item;
|
|
74
|
+
try {
|
|
75
|
+
item = jsonSnapshot(ownData(v, String(i)), depth + 1, ctx);
|
|
76
|
+
}
|
|
77
|
+
catch (e) {
|
|
78
|
+
if (e === CODED_DETAIL_OVER_BUDGET)
|
|
79
|
+
throw e;
|
|
80
|
+
item = undefined;
|
|
81
|
+
}
|
|
82
|
+
if (item !== undefined)
|
|
83
|
+
out.push(item);
|
|
84
|
+
}
|
|
85
|
+
return Object.freeze(out);
|
|
86
|
+
}
|
|
87
|
+
finally {
|
|
88
|
+
ctx.path.delete(v);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
if (!isPlainRecord(v))
|
|
92
|
+
return undefined;
|
|
93
|
+
ctx.path.add(v);
|
|
94
|
+
try {
|
|
95
|
+
const out = {};
|
|
96
|
+
for (const k of Object.keys(v)) {
|
|
97
|
+
let item;
|
|
98
|
+
try {
|
|
99
|
+
item = jsonSnapshot(ownData(v, k), depth + 1, ctx);
|
|
100
|
+
}
|
|
101
|
+
catch (e) {
|
|
102
|
+
if (e === CODED_DETAIL_OVER_BUDGET)
|
|
103
|
+
throw e;
|
|
104
|
+
item = undefined;
|
|
105
|
+
}
|
|
106
|
+
if (item !== undefined)
|
|
107
|
+
Object.defineProperty(out, k, { value: item, enumerable: true, writable: false, configurable: false });
|
|
108
|
+
}
|
|
109
|
+
return Object.freeze(out);
|
|
110
|
+
}
|
|
111
|
+
finally {
|
|
112
|
+
ctx.path.delete(v);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
const isCount = (v) => typeof v === 'number' && Number.isInteger(v) && v >= 0;
|
|
116
|
+
function outputLimitOf(d) {
|
|
117
|
+
try {
|
|
118
|
+
const v = ownData(d, 'outputLimit');
|
|
119
|
+
if (!isPlainRecord(v))
|
|
120
|
+
return undefined;
|
|
121
|
+
const capStop = ownData(v, 'capStop');
|
|
122
|
+
if (typeof capStop !== 'boolean')
|
|
123
|
+
return undefined;
|
|
124
|
+
const outputTokens = ownData(v, 'outputTokens');
|
|
125
|
+
const capTokens = ownData(v, 'capTokens');
|
|
126
|
+
return { capStop, ...(isCount(outputTokens) ? { outputTokens } : {}), ...(isCount(capTokens) ? { capTokens } : {}) };
|
|
127
|
+
}
|
|
128
|
+
catch {
|
|
129
|
+
return undefined;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
function requestRouteOf(d) {
|
|
133
|
+
try {
|
|
134
|
+
const v = ownData(d, 'route');
|
|
135
|
+
if (!isPlainRecord(v))
|
|
136
|
+
return undefined;
|
|
137
|
+
const credentialSource = str(ownData(v, 'credentialSource'));
|
|
138
|
+
const root = str(ownData(v, 'root'));
|
|
139
|
+
if (credentialSource === undefined || root === undefined)
|
|
140
|
+
return undefined;
|
|
141
|
+
const carrier = str(ownData(v, 'carrier'));
|
|
142
|
+
const carrierBag = str(ownData(v, 'carrierBag'));
|
|
143
|
+
return { credentialSource, ...(carrier !== undefined ? { carrier } : {}), ...(carrierBag !== undefined ? { carrierBag } : {}), root };
|
|
144
|
+
}
|
|
145
|
+
catch {
|
|
146
|
+
return undefined;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
30
149
|
function failureDetailOf(cause) {
|
|
31
150
|
try {
|
|
32
151
|
const own = ownValueOf;
|
|
@@ -36,12 +155,85 @@ function failureDetailOf(cause) {
|
|
|
36
155
|
const kind = str(own(v, 'kind'));
|
|
37
156
|
if (kind === undefined)
|
|
38
157
|
return undefined;
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
158
|
+
if (kind === PROVIDER_REJECTED_DETAIL_KIND) {
|
|
159
|
+
const rawStatus = own(v, 'status');
|
|
160
|
+
const status = typeof rawStatus === 'number' && Number.isInteger(rawStatus) && rawStatus >= 400 && rawStatus <= 599 ? rawStatus : undefined;
|
|
161
|
+
if (status === undefined)
|
|
162
|
+
return undefined;
|
|
163
|
+
const code = str(own(v, 'code'));
|
|
164
|
+
const providerCondition = optionalDetailString(v, 'providerCondition');
|
|
165
|
+
const providerConditionSource = optionalDetailString(v, 'providerConditionSource');
|
|
166
|
+
let providerResetAtMs;
|
|
167
|
+
try {
|
|
168
|
+
const r = ownData(v, 'providerResetAtMs');
|
|
169
|
+
providerResetAtMs = typeof r === 'number' && Number.isFinite(r) && r >= 0 ? r : undefined;
|
|
170
|
+
}
|
|
171
|
+
catch {
|
|
172
|
+
providerResetAtMs = undefined;
|
|
173
|
+
}
|
|
174
|
+
const route = requestRouteOf(v);
|
|
175
|
+
return {
|
|
176
|
+
kind: PROVIDER_REJECTED_DETAIL_KIND,
|
|
177
|
+
status,
|
|
178
|
+
...(code !== undefined ? { code } : {}),
|
|
179
|
+
...(providerCondition !== undefined ? { providerCondition } : {}),
|
|
180
|
+
...(providerConditionSource !== undefined ? { providerConditionSource } : {}),
|
|
181
|
+
...(providerResetAtMs !== undefined ? { providerResetAtMs } : {}),
|
|
182
|
+
...(route !== undefined ? { route } : {}),
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
if (kind === CODED_DETAIL_KIND) {
|
|
186
|
+
const inner = ownData(v, 'detail');
|
|
187
|
+
if (!isPlainRecord(inner))
|
|
188
|
+
return undefined;
|
|
189
|
+
let snap;
|
|
190
|
+
try {
|
|
191
|
+
snap = jsonSnapshot(inner, 0, { budget: CODED_DETAIL_BUDGET, path: new Set() });
|
|
192
|
+
}
|
|
193
|
+
catch (e) {
|
|
194
|
+
if (e === CODED_DETAIL_OVER_BUDGET)
|
|
195
|
+
return undefined;
|
|
196
|
+
throw e;
|
|
197
|
+
}
|
|
198
|
+
if (snap === undefined || snap === null || typeof snap !== 'object' || Array.isArray(snap))
|
|
199
|
+
return undefined;
|
|
200
|
+
return { kind: CODED_DETAIL_KIND, detail: snap };
|
|
201
|
+
}
|
|
202
|
+
if (kind === MODEL_OUTPUT_INVALID_DETAIL_KIND) {
|
|
203
|
+
const c = ownData(v, 'cause');
|
|
204
|
+
const cause = MODEL_OUTPUT_INVALID_CAUSES.find((w) => w === c);
|
|
205
|
+
if (cause === undefined)
|
|
206
|
+
return undefined;
|
|
207
|
+
const outputLimit = outputLimitOf(v);
|
|
208
|
+
return { kind: MODEL_OUTPUT_INVALID_DETAIL_KIND, cause, ...(outputLimit !== undefined ? { outputLimit } : {}) };
|
|
209
|
+
}
|
|
210
|
+
return { kind: 'unrecognized', word: kind };
|
|
211
|
+
}
|
|
212
|
+
catch {
|
|
213
|
+
return undefined;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
function optionalDetailString(d, key) {
|
|
217
|
+
try {
|
|
218
|
+
return readOwnDataNonEmptyString(d, key);
|
|
219
|
+
}
|
|
220
|
+
catch {
|
|
221
|
+
return undefined;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
const FINISH_REASON_UNKNOWN_DETAIL_KIND = 'finish_reason_unknown';
|
|
225
|
+
function completedDetailOf(cause) {
|
|
226
|
+
try {
|
|
227
|
+
const v = readOwnDataValue(cause, 'detail');
|
|
228
|
+
if (typeof v !== 'object' || v === null || Array.isArray(v))
|
|
42
229
|
return undefined;
|
|
43
|
-
const
|
|
44
|
-
|
|
230
|
+
const kind = readOwnDataNonEmptyString(v, 'kind');
|
|
231
|
+
if (kind === undefined)
|
|
232
|
+
return undefined;
|
|
233
|
+
if (kind !== FINISH_REASON_UNKNOWN_DETAIL_KIND)
|
|
234
|
+
return { kind: 'unrecognized', word: kind };
|
|
235
|
+
const word = readOwnDataNonEmptyString(v, 'finishReasonUnknown');
|
|
236
|
+
return word === undefined ? undefined : { kind: FINISH_REASON_UNKNOWN_DETAIL_KIND, finishReasonUnknown: word };
|
|
45
237
|
}
|
|
46
238
|
catch {
|
|
47
239
|
return undefined;
|
|
@@ -71,6 +263,16 @@ function blockedDetailOf(cause) {
|
|
|
71
263
|
}
|
|
72
264
|
}
|
|
73
265
|
export function readRunTerminal(result) {
|
|
266
|
+
if (typeof result !== 'object' || result === null || Array.isArray(result))
|
|
267
|
+
return null;
|
|
268
|
+
const view = doneResultView(result);
|
|
269
|
+
if (view.replay) {
|
|
270
|
+
const inner = readRunTerminalArm(view.engine) ?? readRunTerminalArm({ status: view.row?.status, errorCode: view.row?.errorCode, errorMessage: view.row?.error });
|
|
271
|
+
return inner === null ? null : { ...inner, replay: true };
|
|
272
|
+
}
|
|
273
|
+
return readRunTerminalArm(result);
|
|
274
|
+
}
|
|
275
|
+
function readRunTerminalArm(result) {
|
|
74
276
|
if (typeof result !== 'object' || result === null || Array.isArray(result))
|
|
75
277
|
return null;
|
|
76
278
|
const r = result;
|
|
@@ -87,8 +289,10 @@ export function readRunTerminal(result) {
|
|
|
87
289
|
return { kind: 'paused', plane: 'cause', flatStatus: parkWord, ...(kind === 'paused' ? (pauseOf(c) ?? {}) : {}) };
|
|
88
290
|
}
|
|
89
291
|
switch (kind) {
|
|
90
|
-
case 'completed':
|
|
91
|
-
|
|
292
|
+
case 'completed': {
|
|
293
|
+
const detail = completedDetailOf(c);
|
|
294
|
+
return { kind: 'completed', plane: 'cause', ...(detail !== undefined ? { detail } : {}) };
|
|
295
|
+
}
|
|
92
296
|
case 'failed': {
|
|
93
297
|
const code = str(c.code);
|
|
94
298
|
const message = str(c.message);
|
|
@@ -160,11 +364,10 @@ export function readRunTerminal(result) {
|
|
|
160
364
|
...(message !== undefined ? { message } : {}),
|
|
161
365
|
};
|
|
162
366
|
}
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
]);
|
|
367
|
+
const REVIEW_PARK_GATE_KIND_TUPLE = ['plan_review', 'needs_review'];
|
|
368
|
+
const _reviewParkGateKindPins = [true, true];
|
|
369
|
+
void _reviewParkGateKindPins;
|
|
370
|
+
export const REVIEW_PARK_GATE_KINDS = Object.freeze([...REVIEW_PARK_GATE_KIND_TUPLE]);
|
|
168
371
|
export function runTerminalGateKind(read) {
|
|
169
372
|
return read !== null && read.kind === 'paused' ? str(read.gate?.kind) : undefined;
|
|
170
373
|
}
|
package/dist/sandboxWire.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { lastFlagValue } from './argvFlagValue.js';
|
|
2
|
+
import { CAPABILITY_IMAGE_INDEX_REQUIRED } from './engineErrorCodes.js';
|
|
2
3
|
const MAX_PROFILE_LEN = 128;
|
|
3
4
|
const USAGE_HINT = "sema: --sandbox expects a profile name or 'auto'.\n" +
|
|
4
5
|
' --sandbox <profile> run on that sandbox image profile (k8s-lane workers; list: sema cloud images list)\n' +
|
|
@@ -45,8 +46,20 @@ export const SANDBOX_K8S_ONLY_400_ANCHOR = 'only supported on the k8s sandbox ba
|
|
|
45
46
|
export const SANDBOX_NO_IMAGE_INDEX_400_ANCHOR = 'requires the image index';
|
|
46
47
|
export const SANDBOX_NO_PUBLISHED_IMAGE_404_ANCHOR = 'no published sandbox image for profile';
|
|
47
48
|
export const SANDBOX_CASCADE_CONFLICT_400_ANCHOR = 'not supported together with cascade/verify';
|
|
49
|
+
const SANDBOX_IMAGE_INDEX_501_HINT = 'Cloud sandbox images are not available on this engine: its storage backend keeps no image index, so profiles cannot be listed or selected here.\n' +
|
|
50
|
+
'Use a worker backed by a SQL store (it has the image index), or re-run without --sandbox.';
|
|
51
|
+
function imageIndexRequiredCode(err) {
|
|
52
|
+
try {
|
|
53
|
+
return typeof err === 'object' && err !== null && err.errorCode === CAPABILITY_IMAGE_INDEX_REQUIRED;
|
|
54
|
+
}
|
|
55
|
+
catch {
|
|
56
|
+
return false;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
48
59
|
export function sandboxDegradeHint(err) {
|
|
49
60
|
const e = err;
|
|
61
|
+
if (e?.status === 501 && imageIndexRequiredCode(err))
|
|
62
|
+
return SANDBOX_IMAGE_INDEX_501_HINT;
|
|
50
63
|
if (typeof e?.status !== 'number' || typeof e?.message !== 'string')
|
|
51
64
|
return undefined;
|
|
52
65
|
const msg = e.message;
|
package/dist/sdkWireTransit.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { AgentClient } from '@sema-agent/sdk';
|
|
2
2
|
export { isApprovalRequestFrameV1, isApprovalRevokeFrameV1 } from '@sema-agent/sdk';
|
|
3
3
|
export { pushSessionBundle, pullSessionBundle, importSessionBundle, APIError } from '@sema-agent/sdk';
|
|
4
|
-
export
|
|
4
|
+
export { APPROVAL_DECIDE_GATE_KINDS, PLAN_REVIEW_GATE_KINDS } from '@sema-agent/sdk';
|
|
5
|
+
export type { TaskRequest, SessionPermissionRules, SemaSettings, SkillSpec, AgentEvent, RunReceipt, CancelAck, RunRecord, ToolApprovalRespondAck, FleetTaskRow, FleetWorkflowRow, ApprovalCard, ApprovalRequestFrame, ApprovalRiskAxes, AskDecisionAck, AskDecisionBody, PolicyInfo, CcImportLayer, CcImportPrepareResult, CcImportRedeemResult, CcImportSettingsLayer, CcImportSkippedRule, PersistedRule, RuleRevokeRequest, RuleRevokeResult, ApprovalDecideGateKind, PlanReviewGateKind, } from '@sema-agent/sdk';
|
package/dist/sdkWireTransit.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export { AgentClient } from '@sema-agent/sdk';
|
|
2
2
|
export { isApprovalRequestFrameV1, isApprovalRevokeFrameV1 } from '@sema-agent/sdk';
|
|
3
3
|
export { pushSessionBundle, pullSessionBundle, importSessionBundle, APIError } from '@sema-agent/sdk';
|
|
4
|
+
export { APPROVAL_DECIDE_GATE_KINDS, PLAN_REVIEW_GATE_KINDS } from '@sema-agent/sdk';
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export type SealedKeyReading = {
|
|
2
2
|
kind: 'unobserved';
|
|
3
|
+
} | {
|
|
4
|
+
kind: 'unreadable';
|
|
3
5
|
} | {
|
|
4
6
|
kind: 'not_reported';
|
|
5
7
|
} | {
|
|
@@ -9,8 +11,4 @@ export type SealedKeyReading = {
|
|
|
9
11
|
publicKey: string;
|
|
10
12
|
};
|
|
11
13
|
export declare function projectSealedKeyCapability(caps: unknown): SealedKeyReading | undefined;
|
|
12
|
-
export declare function noteEngineCapsForSealedKey(baseUrl: string, caps: unknown, opts?: {
|
|
13
|
-
generation?: number;
|
|
14
|
-
}): void;
|
|
15
14
|
export declare function observedSealedKey(baseUrl?: string | undefined): SealedKeyReading;
|
|
16
|
-
export declare function __resetSealedKeyReadingsForTests(): void;
|
|
@@ -28,14 +28,7 @@ export function projectSealedKeyCapability(caps) {
|
|
|
28
28
|
const reader = createEngineCapReader({
|
|
29
29
|
name: 'sealedKey',
|
|
30
30
|
project: projectSealedKeyCapability,
|
|
31
|
-
makeUnobserved: () => ({ kind: 'unobserved' }),
|
|
32
31
|
});
|
|
33
|
-
export function noteEngineCapsForSealedKey(baseUrl, caps, opts) {
|
|
34
|
-
reader.note(baseUrl, caps, opts);
|
|
35
|
-
}
|
|
36
32
|
export function observedSealedKey(baseUrl = engineWireTarget()?.baseUrl) {
|
|
37
33
|
return reader.observed(baseUrl);
|
|
38
34
|
}
|
|
39
|
-
export function __resetSealedKeyReadingsForTests() {
|
|
40
|
-
reader.__resetForTests();
|
|
41
|
-
}
|
package/dist/seam.js
CHANGED
|
@@ -102,7 +102,8 @@ const CHROME_ARM_TABLE = {
|
|
|
102
102
|
required: true,
|
|
103
103
|
duty: '整段替换:①`diverged`(never false)在场 ⇒ 自己拼 thinking stream_delta 上屏的端按 content 重渲该块;' +
|
|
104
104
|
'②`committedPrefixDiverged`(never false)在场 ⇒ 所有端把 `committedUuids` 首行就地换成 content,其余行**删除或清空其推理正文**(宿主按自身转录结构选:有父链/压缩段依赖的转录清空优于删,保行身份;安全目标 = 未脱敏字节零留盘;整段换不切片;`committedUuid` = 末条兼容位;`committedPrefixLen` = 全部行全文长度之和,单位 UTF-16 代码单元);' +
|
|
105
|
-
'本包在这一形上一个字节都不再交;③三键全缺席 ⇒ 照旧只当对账/定界;④缺席 ≠
|
|
105
|
+
'本包在这一形上一个字节都不再交;③三键全缺席 ⇒ 照旧只当对账/定界;④缺席 ≠ 段没结束,按整条流判;' +
|
|
106
|
+
'⑤序:该段推理尾部的活体增量一律先于本事件到达,本事件之后不再有同段推理增量。',
|
|
106
107
|
},
|
|
107
108
|
wiring_manifest: {
|
|
108
109
|
required: false,
|
|
@@ -150,7 +151,8 @@ const CHROME_ARM_TABLE = {
|
|
|
150
151
|
'🔴 **单位 = JS 字符串长度(UTF-16 代码单元),不是 UTF-8 字节、也不是几条消息**' +
|
|
151
152
|
'(按 UTF-8 字节截会在非 ASCII 正文上截错位置把凭据留在屏上;按消息丢会连合并在同一条消息里的上一段定稿一起删掉),' +
|
|
152
153
|
'照抄 `已committed正文.slice(0, 长度 - committedPrefixLen) + content`;按**增量拼文**计长、不是 content 上的偏移;④三键全缺席 ⇒ 照旧只当对账/定界,拿 content 再渲一行 = 同一段上屏两遍;⑤`segmentId`(恒在场)= 段身份,与本段已过境的 committed 文本行顶层 `_sema_segment_id` 同值 —— 换掉已提交那截时认行的钥匙是**两把**:行 uuid ∧ 段身份(按字节相等找行会被同后缀的独立行冒充)。' +
|
|
153
|
-
'🔴 缺席只表示「没报」,绝不等于「段没结束」——要退回自家启发式必须按整条流判、不按单帧判;⑥`committedUuids[]`(0.71.0 起,在场 = 本窗口已提交行按序、`[]` = 零行、整键缺席 = 本包说不出):`committedPrefixDiverged` ⇒ **按 `committedRows[]` 逐行写回正文**(包已算好:首行 = 前段定稿前缀 + content、其余行空;别整行换首行,提交行可能带上一段定稿),端不再自己数窗口里过境的行,也不再对多行段整发放弃;`committedUuid` =
|
|
154
|
+
'🔴 缺席只表示「没报」,绝不等于「段没结束」——要退回自家启发式必须按整条流判、不按单帧判;⑥`committedUuids[]`(0.71.0 起,在场 = 本窗口已提交行按序、`[]` = 零行、整键缺席 = 本包说不出):`committedPrefixDiverged` ⇒ **按 `committedRows[]` 逐行写回正文**(包已算好:首行 = 前段定稿前缀 + content、其余行空;别整行换首行,提交行可能带上一段定稿),端不再自己数窗口里过境的行,也不再对多行段整发放弃;`committedUuid` = 末条兼容位;' +
|
|
155
|
+
'⑦序:该段尾部的活体增量(`stream_delta`)一律先于本事件到达,本事件之后不再有同段增量(下一条增量属于下一段)。',
|
|
154
156
|
},
|
|
155
157
|
};
|
|
156
158
|
export const CHROME_ARMS = Object.entries(CHROME_ARM_TABLE).map(([kind, d]) => ({ kind, required: d.required, duty: d.duty }));
|