@sema-agent/client-core 0.108.0 → 0.110.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 +294 -0
- package/README.md +77 -40
- package/dist/adapt/arms.js +41 -13
- package/dist/adapt/textStream.d.ts +2 -0
- package/dist/adapt/textStream.js +37 -16
- package/dist/adapter/activeRunSelfHeal.js +1 -1
- package/dist/adapter/downstream/eventToSdkMessage.js +11 -5
- package/dist/agentSession/engineAgentRegistryRead.js +2 -0
- package/dist/bashExitReading.d.ts +12 -0
- package/dist/bashExitReading.js +44 -0
- package/dist/checkpointRowVerdict.d.ts +1 -1
- package/dist/checkpointRowVerdict.js +4 -2
- package/dist/compensations.js +1 -1
- package/dist/declared/supportFloorDeclared.js +1 -1
- package/dist/displayUntrusted.js +132 -14
- package/dist/engineAgentAbsence.d.ts +2 -0
- package/dist/engineAgentAbsence.js +28 -0
- package/dist/engineErrorCodes.d.ts +7 -0
- package/dist/engineErrorCodes.js +7 -0
- package/dist/engineHealthFacts.d.ts +26 -0
- package/dist/engineHealthFacts.js +63 -4
- package/dist/engineInlineTaskStats.d.ts +4 -3
- package/dist/engineInlineTaskStats.js +18 -2
- package/dist/engineNoticeCodes.d.ts +138 -0
- package/dist/engineNoticeCodes.js +662 -55
- package/dist/engineRepoint.d.ts +140 -0
- package/dist/engineRepoint.js +285 -0
- package/dist/engineRowRef.js +2 -0
- package/dist/engineSessionMessages.d.ts +2 -1
- package/dist/engineSessionMessages.js +5 -0
- package/dist/errorSupplementRoles.js +5 -1
- package/dist/fleet/fleetProjection.js +3 -2
- package/dist/fleetTaskDesc.js +3 -3
- package/dist/generated/engineFactTables.d.ts +3 -0
- package/dist/generated/engineFactTables.js +18 -0
- package/dist/generated/engineNoticeTables.js +3 -0
- package/dist/generated/sdkFactTables.d.ts +1 -0
- package/dist/generated/sdkFactTables.js +4 -0
- package/dist/hitl/approvalAskers.d.ts +6 -0
- package/dist/hitl/approvalAskers.js +30 -0
- package/dist/hitl/approvalCardReasons.js +25 -4
- package/dist/hitl/approvalRequestFrameReading.d.ts +21 -0
- package/dist/hitl/approvalRequestFrameReading.js +90 -0
- package/dist/hitl/approvalResolution.d.ts +8 -1
- package/dist/hitl/approvalResolution.js +4 -0
- package/dist/hitl/approvalsFeed.js +1 -1
- package/dist/hitl/askGateWire.js +0 -2
- package/dist/hitl/askParkRowRouting.js +5 -2
- package/dist/hitl/automaticAnswerVerdict.d.ts +5 -2
- package/dist/hitl/automaticAnswerVerdict.js +18 -4
- package/dist/hitl/decisionConflict.d.ts +2 -1
- package/dist/hitl/decisionConflict.js +10 -4
- package/dist/hitl/decisionRefusal.js +1 -0
- package/dist/hitl/decisionSend.d.ts +3 -0
- package/dist/hitl/decisionSend.js +29 -11
- package/dist/hitl/editedApprovalAcceptance.d.ts +25 -0
- package/dist/hitl/editedApprovalAcceptance.js +26 -0
- package/dist/hitl/frameRouter.js +13 -19
- package/dist/hitl/gateLedger.d.ts +0 -4
- package/dist/hitl/gateLedger.js +0 -19
- package/dist/hitl/hitlBridge.d.ts +5 -0
- package/dist/hitl/hitlBridge.js +13 -9
- package/dist/hitl/hitlHostSurface.d.ts +1 -0
- package/dist/hitl/hitlHostSurface.js +7 -2
- package/dist/hitl/hostWithdrawal.d.ts +15 -0
- package/dist/hitl/hostWithdrawal.js +38 -0
- package/dist/hitl/livePendingAsk.js +17 -16
- package/dist/hitl/localAllowRule.js +2 -1
- package/dist/hitl/noAllowCause.d.ts +1 -1
- package/dist/hitl/noAllowCause.js +4 -2
- package/dist/hitl/parkExpiryJudgements.js +26 -1
- package/dist/hitl/parkOwnership.d.ts +2 -0
- package/dist/hitl/parkOwnership.js +48 -8
- package/dist/hitl/parkResolver.js +32 -16
- package/dist/hitl/parkedUnresumable.d.ts +13 -0
- package/dist/hitl/parkedUnresumable.js +80 -0
- package/dist/hitl/permissionRuleScope.d.ts +4 -0
- package/dist/hitl/permissionRuleScope.js +31 -0
- package/dist/hitl/persistedRulesWire.d.ts +2 -0
- package/dist/hitl/persistedRulesWire.js +13 -12
- package/dist/hitl/planReviewWire.js +14 -4
- package/dist/hitl/sessionAllowRoute.js +5 -4
- package/dist/hitl/sessionPolicyWire.js +6 -4
- package/dist/hitl/standingRows.d.ts +2 -5
- package/dist/hitl/standingRows.js +30 -15
- package/dist/hitl/toolApprovalWire.d.ts +42 -9
- package/dist/hitl/toolApprovalWire.js +267 -44
- package/dist/hooksWireCaps.js +35 -4
- package/dist/hostSettingsSource.js +2 -0
- package/dist/hostTurnSettings.d.ts +10 -4
- package/dist/hostTurnSettings.js +112 -5
- package/dist/i18n/messages.en.d.ts +251 -0
- package/dist/i18n/messages.en.js +254 -2
- package/dist/i18n/messages.zh.js +264 -2
- package/dist/index.d.ts +48 -12
- package/dist/index.js +29 -7
- package/dist/inheritEnvCapability.js +2 -0
- package/dist/inputAuthor.d.ts +16 -0
- package/dist/inputAuthor.js +44 -0
- package/dist/interruptRefusalNote.d.ts +2 -0
- package/dist/interruptRefusalNote.js +17 -0
- package/dist/liveModelCatalog.d.ts +2 -0
- package/dist/liveModelCatalog.js +21 -7
- package/dist/liveQuestionStore.d.ts +4 -1
- package/dist/liveQuestionStore.js +12 -3
- package/dist/localEngineJudge.d.ts +75 -0
- package/dist/localEngineJudge.js +242 -0
- package/dist/localEngineOccupancy.d.ts +88 -0
- package/dist/localEngineOccupancy.js +269 -0
- package/dist/localEngineSeatReading.d.ts +29 -0
- package/dist/localEngineSeatReading.js +294 -0
- package/dist/localEngineSpawn.d.ts +113 -0
- package/dist/localEngineSpawn.js +486 -0
- package/dist/localEngineStep.d.ts +286 -0
- package/dist/localEngineStep.js +1086 -0
- package/dist/localEngineStopLadder.d.ts +29 -0
- package/dist/localEngineStopLadder.js +139 -0
- package/dist/localEngineSwapCard.d.ts +43 -0
- package/dist/localEngineSwapCard.js +205 -0
- package/dist/localEngineTiming.d.ts +8 -0
- package/dist/localEngineTiming.js +8 -0
- package/dist/mcpEngineLeg.d.ts +3 -0
- package/dist/mcpEngineLeg.js +38 -1
- package/dist/mcpPanel.js +2 -0
- package/dist/mcpReconnect.d.ts +9 -1
- package/dist/mcpReconnect.js +132 -20
- package/dist/mcpWireCaps.js +2 -2
- package/dist/memoryEntriesWire.d.ts +1 -1
- package/dist/memoryEntriesWire.js +5 -0
- package/dist/modelCapabilityProbe.js +4 -3
- package/dist/modsFace.d.ts +8 -1
- package/dist/modsFace.js +27 -0
- package/dist/noticePresentation.d.ts +2 -0
- package/dist/noticePresentation.js +79 -1
- package/dist/notifications.d.ts +17 -6
- package/dist/notifications.js +67 -19
- package/dist/ownKey.d.ts +5 -0
- package/dist/ownKey.js +8 -1
- package/dist/peerFrames.d.ts +40 -2
- package/dist/peerFrames.js +158 -3
- package/dist/pluginHooksWire.d.ts +2 -1
- package/dist/pluginHooksWire.js +56 -1
- package/dist/replayBody.js +10 -2
- package/dist/request/taskRequest.d.ts +5 -0
- package/dist/request/taskRequest.js +138 -21
- package/dist/resumeRefusalCopy.d.ts +1 -3
- package/dist/resumeRefusalCopy.js +2 -1
- package/dist/retryStatus.d.ts +2 -2
- package/dist/retryStatus.js +2 -0
- package/dist/ruleReadings.js +1 -1
- package/dist/seam.d.ts +24 -2
- package/dist/seam.js +15 -2
- package/dist/seatContract.d.ts +125 -10
- package/dist/seatContract.js +373 -7
- package/dist/sessionBackground.js +4 -1
- package/dist/sessionBackgroundHandoff.js +2 -1
- package/dist/sessionEngine.d.ts +2 -0
- package/dist/sessionEngine.js +111 -0
- package/dist/sessionMemoryStatus.d.ts +2 -1
- package/dist/sessionSyncFileHistory.d.ts +4 -0
- package/dist/sessionSyncFileHistory.js +28 -0
- package/dist/sseIdleTriage.d.ts +13 -1
- package/dist/sseIdleTriage.js +24 -6
- package/dist/subagent/engineSubagentTail.js +6 -0
- package/dist/subagentContentStore.d.ts +12 -0
- package/dist/subagentContentStore.js +72 -11
- package/dist/terminalStatuses.d.ts +1 -0
- package/dist/terminalStatuses.js +4 -1
- package/dist/toolResult.js +18 -5
- package/dist/turnFailurePresentation.js +9 -2
- package/dist/typePins.d.ts +11 -0
- package/dist/usageAnalytics.d.ts +17 -0
- package/dist/usageAnalytics.js +44 -2
- package/dist/wireFailureShape.d.ts +22 -5
- package/dist/wireFailureShape.js +47 -26
- package/dist/wireRefusalCopy.d.ts +31 -1
- package/dist/wireRefusalCopy.js +167 -2
- package/docs/INTEGRATION-CLIENTS.md +3269 -21
- package/package.json +5 -5
|
@@ -8,9 +8,9 @@ import { PROJECT_MEMORY_DISABLED } from '../projectMemory.js';
|
|
|
8
8
|
import { frameFamiliesJudgementOf } from '../approvalFrameFamilies.js';
|
|
9
9
|
import { outputStyleSeatAdmitted } from '../outputStyleSeatCapability.js';
|
|
10
10
|
import { refuseBadApprovalReach } from '../approvalReachWire.js';
|
|
11
|
-
import { HOST_SUPPLIED_KEYS, UNWIRED_HOST_TURN_SETTINGS, buildHostTurnSettings, hostIntakeSnapshotOf, hostFileHistoryRestoreNotice, hostProjectionNotice, hostTurnSettingsOf, intersectHostHooks, rethrowHostResolvedDeferred, hostSettingsRefusedError, } from '../hostTurnSettings.js';
|
|
11
|
+
import { HOST_SUPPLIED_KEYS, UNWIRED_HOST_TURN_SETTINGS, buildHostTurnSettings, hostIntakeSnapshotOf, hostFileHistoryRestoreNotice, hostProjectionNotice, hostStyleNotAppliedNotice, hostTurnSettingsOf, hookEnvNamesOf, intersectHostHooks, rethrowHostResolvedDeferred, hostSettingsRefusedError, } from '../hostTurnSettings.js';
|
|
12
12
|
import { SUBMISSION_ORIGINS, SUBMISSION_SURFACES, SUBMISSION_TOOLS, submissionAxesOf, } from './submissionIdentity.js';
|
|
13
|
-
import { withAssemblyRefusal } from '../wireFailureShape.js';
|
|
13
|
+
import { slotReadOf, withAssemblyRefusal } from '../wireFailureShape.js';
|
|
14
14
|
import { isPlainRecord, materializeJsonFaithful, shapeTag } from '../jsonFaithful.js';
|
|
15
15
|
export const REQUEST_FIELD_MATRIX = [
|
|
16
16
|
{ field: 'objective', lanes: ['interactive', 'print', 'utility'], live: false, why: '本 turn 的真实输入,每条车道都必需', whyUtilityLane: '恒座:三条车道都必须带上本次提交的模型面输入' },
|
|
@@ -29,6 +29,7 @@ export const REQUEST_FIELD_MATRIX = [
|
|
|
29
29
|
{ field: 'mcpServers', lanes: ['interactive', 'print'], live: true, why: '本地 .mcp.json 投影;service 单用户门决定是否兑现', whyUtilityLane: '无座:MCP 服务挂的是工具,与零工具面矛盾' },
|
|
30
30
|
{ field: 'settings.webSearch', lanes: ['interactive', 'print'], live: true, why: 'SEMA_WEBSEARCH_* / settings.json;per-request 配置赢过部署 env', whyUtilityLane: '无座:联网检索是一只工具,与零工具面矛盾' },
|
|
31
31
|
{ field: 'settings.hooks', lanes: ['interactive', 'print'], live: true, why: '[495]① 用户 settings 文件 hooks 逐字上 wire', whyUtilityLane: '无座:hook 挂在工具门上(零工具面没有门),而且 side-channel 是壳自己的提交,不该继承用户那份 hook 表' },
|
|
32
|
+
{ field: 'settings.env', lanes: ['interactive', 'print'], live: true, why: '交引擎执行的 http hook 头 `$NAME` 插值的那一层环境(服务端 `settings.env`:引擎 hook 环境 = 十二名基础名单 + 本键;同一份也进引擎命令 hook 与单用户宿主车道的会话 shell 环境 —— 服务端的设计)。两条用户车道都把 hooks 交给引擎执行 ⇒ 都有座,与 settings.hooks 同座。值只由宿主自供项入口按 hooks 那一行算出:名集 = 这一发请求体 hooks 里引擎点亮的事件下 http 条目 allowedEnvVars 之并 ∩ 宿主环境在场,值 = 环境原值,名集空 ⇒ 键缺席;不按凭据名预筛(凭据判官只在服务端:400 request.env_credential_refused)', whyUtilityLane: '无座:与 settings.hooks 同理由 —— side-channel 不带用户的 hook 表,就没有要插值的 http 头;带上它只会把宿主环境里的值交给一条零工具面的提交' },
|
|
32
33
|
{ field: 'settings.approvalFrameFamilies', lanes: ['interactive', 'print'], live: true, why: '这条运行的客户端渲得了哪些审批开卡帧族的**逐运行声明**(服务端提交体 `settings.approvalFrameFamilies`:词数组,值族闭集 tool_approval / approval_request;一条运行只在声明含服务端呈的那一族时才开审批卡,不含 ⇒ 问当场交无人值守政策口、不出卡)。两条用户车道都有审批腿(交互面出卡答人;`-p` 面交宿主的审批口),都得声明;🔴 只在能力读数 confirmed(受理位 `taskSettings.approvalFrameFamilies` 恒真 ∧ 值族位合格)时由装配口自己铸,老服务端(受理位缺席)对表外 settings 子键整条 400', whyUtilityLane: '无座:side-channel 强制零工具面(`excludeAllTools`),没有门控调用、不会问审批 ⇒ 声明没有对象;带上它只会在不认识这一键的老服务端上给这条提交多一种 400' },
|
|
33
34
|
{ field: 'settings.<resolved>', lanes: ['interactive', 'print'], live: true, why: 'settings resolver 的 effective 快照(hooks/env/model + 已解析权限投影)。两条车道同源:交互面 replEntry / print 面 printModeEngine 各跑一遍同一个 resolver,产物经同一个 buildWireSettingsStamp 投影。开放集(子键不可枚举)⇒ unregisteredRequestKeys 放行本车道 settings 的**表外**子键,但表内异车道子键仍点名', whyUtilityLane: '无座:这一位是**开放集 spread**(子键原样即 wire 键),摊开的是用户 settings 的已解析面(权限 / env / 模型)。side-channel 是壳自己的提交:摊上去既无用(零工具面没有工具门求值权限)又把用户的配置面带进了一条他没参与的提交。🔴 无座 ⇒ 本车道整只快照不产。🔴 **本行无座的前提由构造期校验兜住**:剥掉的是用户显式的 deny / ask,所以 `refuseUtilityWithoutToolUnload` 强制这条车道必须带字面 `excludeAllTools: true` —— 否则产出会是一条「既没卸工具、又没带用户 deny」的请求(比无人值守车道同一份输入更宽)' },
|
|
34
35
|
{ field: 'repo', lanes: ['interactive', 'print'], live: true, why: 'scan/code-review 场景的仓库坐标(passthrough;server 是权威校验方,本层不铸第二判官)', whyUtilityLane: '无座:场景键;side-channel 不走场景' },
|
|
@@ -217,6 +218,7 @@ const SETTINGS_KEY_ROUTES = {
|
|
|
217
218
|
webSearch: row('settings.webSearch'),
|
|
218
219
|
ultracode: row('settings.ultracode'),
|
|
219
220
|
hooks: row('settings.hooks'),
|
|
221
|
+
env: row('settings.env'),
|
|
220
222
|
approvalFrameFamilies: row('settings.approvalFrameFamilies'),
|
|
221
223
|
outputStyle: { via: 'always' },
|
|
222
224
|
};
|
|
@@ -520,27 +522,59 @@ export function refilterHostSettings(request, fresh, lane) {
|
|
|
520
522
|
const base = tight.request;
|
|
521
523
|
const tightened = tight.tightened;
|
|
522
524
|
const settings = base.settings;
|
|
523
|
-
if (!isPlainRecord(settings)
|
|
525
|
+
if (!isPlainRecord(settings))
|
|
524
526
|
return Object.freeze({ kind: 'send', request: base, hooksDropped: 0, tightened });
|
|
525
|
-
const
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
527
|
+
const unjudged = () => Object.freeze({ kind: 'refuse', notice: refuseNotice() });
|
|
528
|
+
let nextSettings = settings;
|
|
529
|
+
let hooksDropped = 0;
|
|
530
|
+
let finalHooks;
|
|
531
|
+
if (Object.hasOwn(settings, 'hooks')) {
|
|
532
|
+
const sentHooks = settings.hooks;
|
|
533
|
+
if (intake.dispositions['settings.hooks'] === 'unwired')
|
|
534
|
+
finalHooks = sentHooks;
|
|
535
|
+
else {
|
|
536
|
+
const now = intake.carried.hooks;
|
|
537
|
+
if (!isPlainRecord(sentHooks))
|
|
538
|
+
return unjudged();
|
|
539
|
+
const cut = intersectHostHooks(sentHooks, now);
|
|
540
|
+
if (!cut.judged)
|
|
541
|
+
return unjudged();
|
|
542
|
+
finalHooks = cut.hooks;
|
|
543
|
+
if (cut.dropped > 0) {
|
|
544
|
+
const { hooks: _sentHooks, ...restSettings } = settings;
|
|
545
|
+
void _sentHooks;
|
|
546
|
+
nextSettings = cut.hooks === undefined ? restSettings : { ...restSettings, hooks: cut.hooks };
|
|
547
|
+
hooksDropped = cut.dropped;
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
if (Object.hasOwn(nextSettings, 'env')) {
|
|
552
|
+
const sentEnv = nextSettings.env;
|
|
553
|
+
if (!isPlainRecord(sentEnv))
|
|
554
|
+
return unjudged();
|
|
555
|
+
let names;
|
|
556
|
+
try {
|
|
557
|
+
names = hookEnvNamesOf(finalHooks);
|
|
558
|
+
}
|
|
559
|
+
catch {
|
|
560
|
+
return unjudged();
|
|
561
|
+
}
|
|
562
|
+
const nowEnv = intake.carried.env;
|
|
563
|
+
const envUnwired = intake.dispositions['settings.env'] === 'unwired';
|
|
564
|
+
const sentKeys = Object.keys(sentEnv);
|
|
565
|
+
const kept = sentKeys.filter((k) => names.includes(k) && (envUnwired || (nowEnv !== undefined && Object.hasOwn(nowEnv, k))));
|
|
566
|
+
if (kept.length !== sentKeys.length) {
|
|
567
|
+
const { env: _sentEnv, ...restSettings } = nextSettings;
|
|
568
|
+
void _sentEnv;
|
|
569
|
+
nextSettings = kept.length === 0 ? restSettings : { ...restSettings, env: Object.fromEntries(kept.map((k) => [k, sentEnv[k]])) };
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
if (nextSettings === settings)
|
|
536
573
|
return Object.freeze({ kind: 'send', request: base, hooksDropped: 0, tightened });
|
|
537
|
-
const { hooks: _sentHooks, ...restSettings } = settings;
|
|
538
|
-
void _sentHooks;
|
|
539
|
-
const nextSettings = cut.hooks === undefined ? restSettings : { ...restSettings, hooks: cut.hooks };
|
|
540
574
|
const { settings: _sentSettings, ...restRequest } = base;
|
|
541
575
|
void _sentSettings;
|
|
542
576
|
const next = Object.keys(nextSettings).length > 0 ? { ...restRequest, settings: nextSettings } : restRequest;
|
|
543
|
-
return Object.freeze({ kind: 'send', request: next, hooksDropped
|
|
577
|
+
return Object.freeze({ kind: 'send', request: next, hooksDropped, tightened });
|
|
544
578
|
}
|
|
545
579
|
export const MEMORY_CAPTURE_OFF = 'off';
|
|
546
580
|
export function memoryCaptureDeclarationField(declared) {
|
|
@@ -924,6 +958,7 @@ export function assembleTaskRequest(input, laneOrIdentity) {
|
|
|
924
958
|
hooks: intake.carried.hooks,
|
|
925
959
|
outputStyle: intake.carried.outputStyle,
|
|
926
960
|
approvalFrameFamilies: approvalFamilies,
|
|
961
|
+
env: intake.carried.env,
|
|
927
962
|
};
|
|
928
963
|
refuseBadMemoryCapture(memoryCaptureIn);
|
|
929
964
|
refuseBadMaxCostUsd(maxCostUsdIn);
|
|
@@ -1080,6 +1115,7 @@ export function assembleTaskRequest(input, laneOrIdentity) {
|
|
|
1080
1115
|
...(onSetting('webSearch') ? { webSearch: s.webSearch } : {}),
|
|
1081
1116
|
...(onSetting('ultracode') ? { ultracode: s.ultracode } : {}),
|
|
1082
1117
|
...(onSetting('hooks') ? { hooks: s.hooks } : {}),
|
|
1118
|
+
...(onSetting('env') ? { env: { ...s.env } } : {}),
|
|
1083
1119
|
...(s.outputStyle !== undefined ? { outputStyle: s.outputStyle } : {}),
|
|
1084
1120
|
...(onSetting('approvalFrameFamilies') ? { approvalFrameFamilies: [...(s.approvalFrameFamilies ?? [])] } : {}),
|
|
1085
1121
|
};
|
|
@@ -1228,6 +1264,74 @@ export function thinkingTurnProjection(input) {
|
|
|
1228
1264
|
return projectThinkingCore({ lane, latch, strength, floor, ultracodeStamped: seated && inPlay('settings.ultracode', ultracode) && ultracode === true });
|
|
1229
1265
|
}
|
|
1230
1266
|
export function applyLiveRequestDefaults(req, host) {
|
|
1267
|
+
return liveRequestDefaultsOf(req, host).request;
|
|
1268
|
+
}
|
|
1269
|
+
export function applyLiveRequestDefaultsWithNotices(req, host) {
|
|
1270
|
+
return liveRequestDefaultsOf(req, host);
|
|
1271
|
+
}
|
|
1272
|
+
const SELF_KNOWLEDGE_JOIN = '\n\n';
|
|
1273
|
+
const OUTPUT_STYLE_MAX_CHARS = 16384;
|
|
1274
|
+
function selfKnowledgeSeatOf(block, readBody) {
|
|
1275
|
+
if (typeof block !== 'string')
|
|
1276
|
+
return { kind: 'set', value: block };
|
|
1277
|
+
let body;
|
|
1278
|
+
const read = readBody();
|
|
1279
|
+
if (read !== undefined) {
|
|
1280
|
+
if (read.presence === 'unreadable')
|
|
1281
|
+
return { kind: 'set', value: block, notice: hostStyleNotAppliedNotice('unreadable', OUTPUT_STYLE_MAX_CHARS) };
|
|
1282
|
+
if (read.presence === 'present' && read.value !== undefined && read.value !== null) {
|
|
1283
|
+
if (typeof read.value !== 'string')
|
|
1284
|
+
return { kind: 'set', value: block, notice: hostStyleNotAppliedNotice('unreadable', OUTPUT_STYLE_MAX_CHARS) };
|
|
1285
|
+
if (read.value.trim() !== '')
|
|
1286
|
+
body = read.value;
|
|
1287
|
+
}
|
|
1288
|
+
}
|
|
1289
|
+
if (body === undefined)
|
|
1290
|
+
return { kind: 'set', value: block };
|
|
1291
|
+
let merged;
|
|
1292
|
+
let separable = false;
|
|
1293
|
+
if (block.trim() === '' || body === block || body.startsWith(block + SELF_KNOWLEDGE_JOIN)) {
|
|
1294
|
+
merged = body;
|
|
1295
|
+
}
|
|
1296
|
+
else if (block.endsWith(SELF_KNOWLEDGE_JOIN + body)) {
|
|
1297
|
+
merged = block;
|
|
1298
|
+
}
|
|
1299
|
+
else {
|
|
1300
|
+
merged = block + SELF_KNOWLEDGE_JOIN + body;
|
|
1301
|
+
separable = true;
|
|
1302
|
+
}
|
|
1303
|
+
if (merged.length <= OUTPUT_STYLE_MAX_CHARS)
|
|
1304
|
+
return { kind: 'set', value: merged };
|
|
1305
|
+
const notice = hostStyleNotAppliedNotice('oversize', OUTPUT_STYLE_MAX_CHARS);
|
|
1306
|
+
return separable && block.length <= OUTPUT_STYLE_MAX_CHARS ? { kind: 'set', value: block, notice } : { kind: 'omit', notice };
|
|
1307
|
+
}
|
|
1308
|
+
const styleBodyReadOf = (settings) => () => typeof settings === 'object' && settings !== null ? slotReadOf(settings, 'outputStyle') : undefined;
|
|
1309
|
+
const appendBodyReadOf = (req) => () => typeof req === 'object' && req !== null ? slotReadOf(req, 'appendSystemPrompt') : undefined;
|
|
1310
|
+
function settingsWithStyleSeat(settings, seat) {
|
|
1311
|
+
const next = {};
|
|
1312
|
+
const put = (key, value) => {
|
|
1313
|
+
Object.defineProperty(next, key, { value, writable: true, enumerable: true, configurable: true });
|
|
1314
|
+
};
|
|
1315
|
+
const src = Object(settings);
|
|
1316
|
+
let placed = false;
|
|
1317
|
+
for (const key of Reflect.ownKeys(src)) {
|
|
1318
|
+
const d = Object.getOwnPropertyDescriptor(src, key);
|
|
1319
|
+
if (d === undefined || d.enumerable !== true)
|
|
1320
|
+
continue;
|
|
1321
|
+
if (key === 'outputStyle') {
|
|
1322
|
+
if (seat.kind === 'set')
|
|
1323
|
+
put(key, seat.value);
|
|
1324
|
+
placed = true;
|
|
1325
|
+
continue;
|
|
1326
|
+
}
|
|
1327
|
+
put(key, src[key]);
|
|
1328
|
+
}
|
|
1329
|
+
if (!placed && seat.kind === 'set')
|
|
1330
|
+
put('outputStyle', seat.value);
|
|
1331
|
+
return Reflect.ownKeys(next).length > 0 ? next : undefined;
|
|
1332
|
+
}
|
|
1333
|
+
function liveRequestDefaultsOf(req, host) {
|
|
1334
|
+
const notices = [];
|
|
1231
1335
|
const out = { ...req };
|
|
1232
1336
|
if (out.cwd == null && host.cwd !== undefined)
|
|
1233
1337
|
out.cwd = host.cwd;
|
|
@@ -1249,11 +1353,24 @@ export function applyLiveRequestDefaults(req, host) {
|
|
|
1249
1353
|
}
|
|
1250
1354
|
if (host.selfKnowledge !== undefined) {
|
|
1251
1355
|
if (host.appendSystemPromptCapable) {
|
|
1252
|
-
|
|
1356
|
+
const seat = selfKnowledgeSeatOf(host.selfKnowledge.forAppend, appendBodyReadOf(req));
|
|
1357
|
+
if (seat.notice !== undefined)
|
|
1358
|
+
appendOwnElement(notices, seat.notice);
|
|
1359
|
+
if (seat.kind === 'set')
|
|
1360
|
+
out.appendSystemPrompt = seat.value;
|
|
1361
|
+
else
|
|
1362
|
+
delete out.appendSystemPrompt;
|
|
1253
1363
|
}
|
|
1254
1364
|
else {
|
|
1255
1365
|
const settings = (out.settings ?? {});
|
|
1256
|
-
|
|
1366
|
+
const seat = selfKnowledgeSeatOf(host.selfKnowledge.forOutputStyle, styleBodyReadOf(settings));
|
|
1367
|
+
if (seat.notice !== undefined)
|
|
1368
|
+
appendOwnElement(notices, seat.notice);
|
|
1369
|
+
const next = settingsWithStyleSeat(settings, seat);
|
|
1370
|
+
if (next !== undefined)
|
|
1371
|
+
out.settings = next;
|
|
1372
|
+
else
|
|
1373
|
+
delete out.settings;
|
|
1257
1374
|
}
|
|
1258
1375
|
}
|
|
1259
1376
|
if (out.outputStyle === undefined && host.outputStyleSeat !== undefined && outputStyleSeatAdmitted(host.outputStyleSeatReading)) {
|
|
@@ -1276,7 +1393,7 @@ export function applyLiveRequestDefaults(req, host) {
|
|
|
1276
1393
|
delete out.sessionId;
|
|
1277
1394
|
}
|
|
1278
1395
|
refuseRequireExistingWithoutSession(out.requireExistingSession, out.sessionId, 'applyLiveRequestDefaults');
|
|
1279
|
-
return out;
|
|
1396
|
+
return Object.freeze({ request: out, notices: Object.freeze(notices) });
|
|
1280
1397
|
}
|
|
1281
1398
|
export function unregisteredRequestKeys(req, lane) {
|
|
1282
1399
|
const liveDefaults = liveDefaultKeyNames();
|
|
@@ -43,12 +43,10 @@ export interface ParkedResumeStartupDetail {
|
|
|
43
43
|
code: string;
|
|
44
44
|
cause: ParkedResumeStartupCause;
|
|
45
45
|
taskId?: string;
|
|
46
|
-
startupCause?: ResumeStartupCause
|
|
46
|
+
startupCause?: ResumeStartupCause;
|
|
47
47
|
resendable: false;
|
|
48
48
|
denyStaysOpen: true;
|
|
49
49
|
}
|
|
50
|
-
declare const RESUME_CAUSE_CORE_AHEAD: readonly ["transcript_corrupt"];
|
|
51
|
-
type ResumeCauseCoreAhead = Exclude<(typeof RESUME_CAUSE_CORE_AHEAD)[number], ResumeStartupCause>;
|
|
52
50
|
export declare function parkedResumeStartupFromError(err: unknown, decision?: ParkedResumeStartupDecision): ParkedResumeStartupDetail | null;
|
|
53
51
|
export declare function parkedResumeStartupContent(detail: ParkedResumeStartupDetail, lang?: UiLanguage): string;
|
|
54
52
|
export interface CheckpointUnsupportedVersionDetail {
|
|
@@ -132,7 +132,6 @@ function parkedResumeStartupCauseWord(err) {
|
|
|
132
132
|
function isResumeStartupCause(v) {
|
|
133
133
|
return typeof v === 'string' && CORE_RESUME_STARTUP_CAUSES.includes(v);
|
|
134
134
|
}
|
|
135
|
-
const RESUME_CAUSE_CORE_AHEAD = Object.freeze(['transcript_corrupt']);
|
|
136
135
|
const _startupCausePin = true;
|
|
137
136
|
void _startupCausePin;
|
|
138
137
|
export function parkedResumeStartupFromError(err, decision) {
|
|
@@ -349,3 +348,5 @@ export function refusedParkBlockedContent(taskId, lane = 'interactive', lang) {
|
|
|
349
348
|
return renderMessage(msg('resume.refusal.park.blockedPrint', { run, cancel: `POST /v1/runs/${runId ?? '<run id>'}/cancel` }), lang);
|
|
350
349
|
return renderMessage(msg('resume.refusal.park.blockedInteractive', { run }), lang);
|
|
351
350
|
}
|
|
351
|
+
const _pinRefusedPark = [true, true, true];
|
|
352
|
+
void _pinRefusedPark;
|
package/dist/retryStatus.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { BrainStatusPhase } from '@sema-agent/sdk';
|
|
1
2
|
import type { UiLanguage } from './env/uiLanguage.js';
|
|
2
3
|
export type RetryStatus = {
|
|
3
4
|
kind: 'stalled';
|
|
@@ -62,7 +63,7 @@ interface RetryStatusErrorPayload {
|
|
|
62
63
|
} | null;
|
|
63
64
|
}
|
|
64
65
|
export declare const BRAIN_STATUS_PHASES: readonly ["rate_limited", "retrying", "reconnecting", "circuit_open", "recovered", "gave_up", "waiting_first_token"];
|
|
65
|
-
export type BrainStatusPhase
|
|
66
|
+
export type { BrainStatusPhase };
|
|
66
67
|
export type BrainRetryErrClass = 'connect_refused' | 'transport' | 'stall' | 'rate_limit' | 'server' | 'http' | 'output_cap';
|
|
67
68
|
export interface BrainStatusPayload {
|
|
68
69
|
phase: BrainStatusPhase | (string & {});
|
|
@@ -161,4 +162,3 @@ export interface ResultWayOut {
|
|
|
161
162
|
}
|
|
162
163
|
export declare function resultWayOutOf(frame: object | null | undefined): ResultWayOut | undefined;
|
|
163
164
|
export declare function wayOutSentence(wayOut: ResultWayOut | null | undefined, lang?: UiLanguage): string | undefined;
|
|
164
|
-
export {};
|
package/dist/retryStatus.js
CHANGED
|
@@ -11,6 +11,8 @@ export const BRAIN_STATUS_PHASES = [
|
|
|
11
11
|
'gave_up',
|
|
12
12
|
'waiting_first_token',
|
|
13
13
|
];
|
|
14
|
+
const _brainStatusPhasePin = [true, true];
|
|
15
|
+
void _brainStatusPhasePin;
|
|
14
16
|
export const BRAIN_STATUS_WAIT_SEGMENTS = Object.freeze(['response_headers', 'first_token']);
|
|
15
17
|
void true;
|
|
16
18
|
void true;
|
package/dist/ruleReadings.js
CHANGED
|
@@ -122,7 +122,7 @@ export function ruleNearMissSentence(rows, lang) {
|
|
|
122
122
|
const named = shown
|
|
123
123
|
.map((it) => renderMessage(msg('rules.refusal.item', {
|
|
124
124
|
rule: `"${capForDisplay(it.rule, NEAR_MISS_RULE_MAX)}"`,
|
|
125
|
-
reason: renderMessage(msg('rules.nearMiss.reason', { mounted:
|
|
125
|
+
reason: renderMessage(msg('rules.nearMiss.reason', { mounted: displayUntrusted(it.mounted, { max: NEAR_MISS_NAME_MAX, escapeBackslashes: 'auto' }) }), lang),
|
|
126
126
|
}), lang))
|
|
127
127
|
.join(separator);
|
|
128
128
|
const rest = items.length - shown.length;
|
package/dist/seam.d.ts
CHANGED
|
@@ -8,6 +8,8 @@ import type { SuspendedReopenReading } from './hitl/suspendedReopen.js';
|
|
|
8
8
|
import type { PlanReviewCardFacts } from './planReviewCardFacts.js';
|
|
9
9
|
import type { ToolKillCause } from './toolResult.js';
|
|
10
10
|
import type { HumanInputAttachmentView } from './ownKey.js';
|
|
11
|
+
import type { SubagentAliasScope } from './subagentContentStore.js';
|
|
12
|
+
import type { SessionBoxNoticeFacts } from './peerFrames.js';
|
|
11
13
|
import type { TaskNotificationFields } from './notifications.js';
|
|
12
14
|
export interface AbortSignalLike {
|
|
13
15
|
readonly aborted: boolean;
|
|
@@ -165,7 +167,7 @@ export type ChromeEvent = {
|
|
|
165
167
|
} | ({
|
|
166
168
|
kind: 'run_cost_reconciled';
|
|
167
169
|
laneProof: LaneProof;
|
|
168
|
-
} & RunCostReconcile) | HumanInputChromeEvent | MessageCommittedChromeEvent | EngineNoticeChromeEvent | TextSegmentEndChromeEvent | ThinkingSegmentEndChromeEvent | ToolDisclosureChromeEvent | ToolProgressChromeEvent | ToolRosterDeltaChromeEvent | ContextUsageChromeEvent | CompactionOutcomeChromeEvent | CompactionStartedChromeEvent | SubagentStartedChromeEvent | PromptAssembledChromeEvent | MemorySavedChromeEvent | WiringManifestChromeEvent | ResultTextDivergedChromeEvent | ResultReplayedChromeEvent | ToolParkedChromeEvent | ApprovalRequestChromeEvent | ApprovalRevokeChromeEvent | ApprovalCompleteChromeEvent | SessionTitledChromeEvent | {
|
|
170
|
+
} & RunCostReconcile) | HumanInputChromeEvent | MessageCommittedChromeEvent | EngineNoticeChromeEvent | TextSegmentEndChromeEvent | ThinkingSegmentEndChromeEvent | ToolDisclosureChromeEvent | ToolProgressChromeEvent | ToolRosterDeltaChromeEvent | ContextUsageChromeEvent | CompactionOutcomeChromeEvent | CompactionStartedChromeEvent | SubagentStartedChromeEvent | PromptAssembledChromeEvent | MemorySavedChromeEvent | WiringManifestChromeEvent | ResultTextDivergedChromeEvent | ResultReplayedChromeEvent | ToolParkedChromeEvent | SubagentAliasChromeEvent | SessionBoxNoticeChromeEvent | ApprovalRequestChromeEvent | ApprovalRevokeChromeEvent | ApprovalCompleteChromeEvent | SessionTitledChromeEvent | {
|
|
169
171
|
kind: 'suspended_reopened';
|
|
170
172
|
laneProof: LaneProof;
|
|
171
173
|
reopen: Extract<SuspendedReopenReading, {
|
|
@@ -347,6 +349,21 @@ export interface ToolParkedChromeEvent {
|
|
|
347
349
|
toolUseId: string;
|
|
348
350
|
rowUuid?: string;
|
|
349
351
|
}
|
|
352
|
+
export interface SubagentAliasChromeEvent {
|
|
353
|
+
kind: 'subagent_alias';
|
|
354
|
+
laneProof: LaneProof;
|
|
355
|
+
parentToolCallId: string;
|
|
356
|
+
taskId: string;
|
|
357
|
+
scope: SubagentAliasScope;
|
|
358
|
+
seq?: number;
|
|
359
|
+
}
|
|
360
|
+
export type SessionBoxNoticeChromeEvent = SessionBoxNoticeChromeEnvelope & SessionBoxNoticeFacts;
|
|
361
|
+
export interface SessionBoxNoticeChromeEnvelope {
|
|
362
|
+
kind: 'session_box_notice';
|
|
363
|
+
laneProof: LaneProof;
|
|
364
|
+
text: string;
|
|
365
|
+
rowUuid: string;
|
|
366
|
+
}
|
|
350
367
|
export interface EngineNoticeChromeEvent {
|
|
351
368
|
kind: 'engine_notice';
|
|
352
369
|
laneProof: LaneProof;
|
|
@@ -376,8 +393,13 @@ export interface HumanInputChromeEvent {
|
|
|
376
393
|
entryId?: string;
|
|
377
394
|
eventId?: string;
|
|
378
395
|
attachments?: HumanInputAttachmentView[];
|
|
396
|
+
author?: string;
|
|
397
|
+
authorUnreadable?: true;
|
|
398
|
+
extension?: string;
|
|
399
|
+
runOrigin?: string;
|
|
400
|
+
runOriginUnreadable?: true;
|
|
379
401
|
}
|
|
380
|
-
export type { HumanInputAttachmentView } from './ownKey.js';
|
|
402
|
+
export type { HumanInputAttachmentView, HumanInputAttachmentDeclinedByView } from './ownKey.js';
|
|
381
403
|
export interface MessageCommittedChromeEvent {
|
|
382
404
|
kind: 'message_committed';
|
|
383
405
|
laneProof: LaneProof;
|
package/dist/seam.js
CHANGED
|
@@ -140,6 +140,18 @@ const CHROME_ARM_TABLE = {
|
|
|
140
140
|
'按开始行 uuid 认行,不按 toolUseId(调用 id 只在同一条助手消息内唯一)。它的终态由执行腿的结果铸(续跑带见证时接回原行),或永远缺席(停驻被取消 / 过期)。' +
|
|
141
141
|
'连坐旁观者 / 普通错误 / 停驻卡上 Esc(包已自发中断拒绝,行照铸 Interrupted)零枚。',
|
|
142
142
|
},
|
|
143
|
+
subagent_alias: {
|
|
144
|
+
required: false,
|
|
145
|
+
duty: '可选:「委派卡 id → 子代任务 id」别名对(`parentToolCallId` / `taskId` / `scope`)—— 座位 lane 的渲染端收到就调 `noteSeatSubagentAlias(chrome)` 写自己账本里的同一半,' +
|
|
146
|
+
'子代详情的实时输出才按子代任务 id 读得到(子代内容帧只带卡 id)。🔴 座位宿主零逻辑:本臂在座位词表里,按词表转发的宿主自动转发;适配层与渲染层同进程的端(浏览器 lane)适配层已登记,什么都不用做;' +
|
|
147
|
+
'`scope: content` 只写内容归账那一半、`full` 两半都写(含续发目标),别把两者混着登;`full` 臂的 `seq`(帧自带代际号,可缺席)是续发目标「现卡」的顺序证据,交 `noteSeatSubagentAlias` 即可,别自己按到达序排;适配层每次登记都发(tick 逐条各一只),去重在登记口:同对重复收到答 ignored、无副作用;认不得的 `scope` 词整条不登记(读口答 undefined),别猜。',
|
|
148
|
+
},
|
|
149
|
+
session_box_notice: {
|
|
150
|
+
required: false,
|
|
151
|
+
duty: '可选:会话箱通告 —— `noticeKind: inbox`(收件箱一行:pending / delivered 必有,urgent / resupplied 缺席 = 引擎没说,不渲 0)/ `delivery`(投递回执)/ `idle`(对端空闲)。' +
|
|
152
|
+
'渲 `text`(数据面英文)或按界面语言调 `sessionBoxNoticeSentence(本臂, lang)`;🔴 同一条通告有两个载体(转录行 + 本臂),接本臂的宿主按 `rowUuid` 把那一行摘掉、只渲一个;' +
|
|
153
|
+
'`state` 是开集机读位,别回显、别按它猜句子;typed 正体缺席时本臂整个不发(不铸状态词)。',
|
|
154
|
+
},
|
|
143
155
|
result_text_diverged: {
|
|
144
156
|
required: false,
|
|
145
157
|
duty: '可选:终帧正文与已上屏正文**互相都不是对方前缀**时的诚实披露。🔴 处置是把这一拍的转录行**改口**' +
|
|
@@ -151,7 +163,7 @@ const CHROME_ARM_TABLE = {
|
|
|
151
163
|
required: true,
|
|
152
164
|
duty: '用 sdk isApprovalRequestFrameV1 窄化 frame 才取 card/askId/窗三键;窄不下来 ⇒ 呈通用卡(安全元数据 + 人工 approve/deny),' +
|
|
153
165
|
'🔴 永不 auto-deny;开卡前调 claimApprovalCard(身份, { signal }):joined / aborted ⇒ 不开卡,held ⇒ 开卡且每条出口恰调一次 hold.release(settled?)' +
|
|
154
|
-
'(去重判定归包 ——
|
|
166
|
+
'(去重判定归包 —— 同一只审批的活卡 / 停驻行 / 另一条宿主路的持有与结局在进程级持有表 / 已结表里,宿主不自持已收口集;服务端 7.133.0 起一条腿一个帧族,不再有先旧族帧、后本帧的并发);流上下文经 approvalFrameContextOf(这只 chrome 事件) 查,查不到不开卡;' +
|
|
155
167
|
'🔴 账本重放的历史帧只用于时间线渲染,卡集的全量对账基准是开流 preamble(它带的 expiresInMs 是铸帧时刻的旧值);' +
|
|
156
168
|
'card 的 message/args 是模型/工具产文,只渲染永不回喂模型',
|
|
157
169
|
},
|
|
@@ -170,7 +182,8 @@ const CHROME_ARM_TABLE = {
|
|
|
170
182
|
},
|
|
171
183
|
approval_complete: {
|
|
172
184
|
required: true,
|
|
173
|
-
duty: '
|
|
185
|
+
duty: '结局三态只读 classifyApprovalCompleteFrame(frame)(live-expired-parked / live-expired-retract / settled;null = 认不出、别猜结局),不自拼 outcome / cause / parked 的读法;' +
|
|
186
|
+
'清卡用的 askId 经 sdk isApprovalCompleteFrameV1 窄化取,窄不下来按 askId(若有)清卡;按开卡帧的 askId 清本地卡,三态任一都清' +
|
|
174
187
|
'(与撤卡帧不冲突,两帧都可能到;清卡是这张卡的一条出口,呈卡臂登记的持有句柄照放);🔴 永不据本帧推断 run 的归宿(读 run 行 / 停驻面),' +
|
|
175
188
|
'expired 不是拒绝,带 parked 的是转进耐久队列、还在等人;账本重放的消卡帧只用于时间线渲染,卡集对账基准恒为开流 preamble(帧可能整帧丢失)',
|
|
176
189
|
},
|