@sema-agent/client-core 0.112.1 → 0.113.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 +130 -0
- package/README.md +36 -23
- package/dist/adapt/arms.js +7 -1
- package/dist/adapt/textStream.d.ts +2 -0
- package/dist/adapt/textStream.js +27 -1
- package/dist/adapter/activeRunSelfHeal.d.ts +7 -5
- package/dist/adapter/activeRunSelfHeal.js +38 -66
- package/dist/adapter/downstream/eventToSdkMessage.js +4 -0
- package/dist/adapter/downstream/terminalToSdkResult.d.ts +8 -0
- package/dist/adapter/downstream/terminalToSdkResult.js +36 -1
- package/dist/adapter/runStream.d.ts +2 -12
- package/dist/adapter/runStream.js +46 -19
- package/dist/agentSession/engineAgentRegistryRead.js +2 -1
- package/dist/agentSession/engineSessionBackgroundStop.js +2 -2
- package/dist/attachmentOutcome.d.ts +35 -0
- package/dist/attachmentOutcome.js +192 -0
- package/dist/attachmentPathPlan.d.ts +67 -0
- package/dist/attachmentPathPlan.js +203 -0
- package/dist/attachmentRoute.d.ts +9 -1
- package/dist/attachmentRoute.js +23 -2
- package/dist/declared/supportFloorDeclared.d.ts +1 -1
- package/dist/declared/supportFloorDeclared.js +1 -0
- package/dist/deviceRebind.js +2 -3
- package/dist/displayUntrusted.js +126 -19
- package/dist/engineAddress.d.ts +1 -1
- package/dist/engineAddress.js +9 -6
- package/dist/engineErrorCodes.d.ts +3 -0
- package/dist/engineErrorCodes.js +4 -0
- package/dist/engineNoticeCodes.d.ts +34 -4
- package/dist/engineNoticeCodes.js +133 -6
- package/dist/engineUnavailable.d.ts +4 -2
- package/dist/engineUnavailable.js +99 -17
- package/dist/fleet/fleetLedger.d.ts +9 -3
- package/dist/fleet/fleetLedger.js +112 -16
- package/dist/fleet/fleetProjection.d.ts +5 -0
- package/dist/fleet/fleetProjection.js +9 -1
- package/dist/gateVocabulary.d.ts +7 -0
- package/dist/gateVocabulary.js +40 -14
- package/dist/generated/engineFactTables.d.ts +4 -2
- package/dist/generated/engineFactTables.js +198 -2
- package/dist/generated/engineNoticeTables.js +56 -8
- package/dist/generated/settingsSchemaFns.d.ts +7 -0
- package/dist/generated/settingsSchemaFns.js +11 -0
- package/dist/generated/settingsSchemaHash.d.ts +1 -0
- package/dist/generated/settingsSchemaHash.js +58 -0
- package/dist/generated/settingsSchemaOwnKeyRead.js +6 -1
- package/dist/generated/settingsSchemaTables.d.ts +3 -2
- package/dist/generated/settingsSchemaTables.js +14 -0
- package/dist/generated/settingsSchemaTightenVerdict.d.ts +1 -0
- package/dist/generated/settingsSchemaTightenVerdict.js +125 -0
- package/dist/headlessPermissionModeWire.d.ts +7 -2
- package/dist/headlessPermissionModeWire.js +77 -8
- package/dist/hitl/approvalDecisionDoor.d.ts +24 -0
- package/dist/hitl/approvalDecisionDoor.js +77 -0
- package/dist/hitl/approvalDelivery.d.ts +6 -0
- package/dist/hitl/approvalDelivery.js +57 -7
- package/dist/hitl/approvalResolution.d.ts +6 -3
- package/dist/hitl/approvalResolution.js +24 -2
- package/dist/hitl/approvalsFeed.js +1 -1
- package/dist/hitl/automaticAnswerVerdict.d.ts +1 -1
- package/dist/hitl/decisionSend.d.ts +7 -4
- package/dist/hitl/decisionSend.js +90 -41
- package/dist/hitl/frameRouter.d.ts +3 -3
- package/dist/hitl/frameRouter.js +5 -0
- package/dist/hitl/hitlHostSurface.d.ts +3 -2
- package/dist/hitl/hitlHostSurface.js +5 -3
- package/dist/hitl/legacyApprovalShapes.d.ts +142 -0
- package/dist/hitl/legacyApprovalShapes.js +1 -0
- package/dist/hitl/livePendingAsk.d.ts +4 -4
- package/dist/hitl/livePendingAsk.js +5 -3
- package/dist/hitl/parkResolver.js +1 -1
- package/dist/hitl/persistedRulesWire.js +2 -2
- package/dist/hitl/planReviewCard.d.ts +2 -1
- package/dist/hitl/planReviewCard.js +64 -1
- package/dist/hitl/planReviewWire.d.ts +30 -0
- package/dist/hitl/planReviewWire.js +204 -65
- package/dist/hitl/sessionPolicyWire.js +16 -7
- package/dist/hitl/subagentSource.d.ts +1 -0
- package/dist/hitl/subagentSource.js +11 -0
- package/dist/hitl/toolApprovalWire.d.ts +34 -10
- package/dist/hitl/toolApprovalWire.js +182 -33
- package/dist/hookMatcherVerdict.d.ts +2 -1
- package/dist/hookMatcherVerdict.js +3 -2
- package/dist/hooksReaderGenerations.d.ts +8 -0
- package/dist/hooksReaderGenerations.js +49 -0
- package/dist/hooksWireCaps.js +43 -18
- package/dist/hostSettingsSource.d.ts +1 -1
- package/dist/hostSettingsSource.js +2 -2
- package/dist/hostTurnSettings.d.ts +2 -2
- package/dist/hostTurnSettings.js +87 -47
- package/dist/humanTurn.d.ts +2 -1
- package/dist/humanTurn.js +44 -13
- package/dist/humanTurnRead.d.ts +7 -0
- package/dist/humanTurnRead.js +23 -14
- package/dist/humanTurnSentences.js +3 -0
- package/dist/i18n/messages.en.d.ts +91 -5
- package/dist/i18n/messages.en.js +98 -12
- package/dist/i18n/messages.zh.js +108 -15
- package/dist/index.d.ts +29 -15
- package/dist/index.js +17 -9
- package/dist/liveModelCatalog.js +1 -0
- package/dist/liveQuestionStore.d.ts +2 -0
- package/dist/liveQuestionStore.js +7 -2
- package/dist/localConfig/kernel.d.ts +2 -1
- package/dist/localConfig/kernel.js +12 -18
- package/dist/localConfig/mcp/edit.js +25 -27
- package/dist/localConfig/mcp/servers.js +5 -8
- package/dist/localConfig/modelPool.d.ts +6 -1
- package/dist/localConfig/modelPool.js +104 -27
- package/dist/localConfig/modelPoolWords.d.ts +2 -0
- package/dist/localConfig/modelPoolWords.js +1 -0
- package/dist/localConfig/settingsWrite.js +1 -14
- package/dist/localConfig/skills.js +9 -16
- package/dist/localEngineSpawn.d.ts +29 -1
- package/dist/localEngineSpawn.js +62 -1
- package/dist/mcpLiveness.d.ts +1 -1
- package/dist/mcpProbeWire.js +2 -2
- package/dist/mcpReconnect.js +2 -2
- package/dist/model/catalogLoader.js +3 -17
- package/dist/model/onboardJudgement.d.ts +8 -0
- package/dist/model/onboardJudgement.js +8 -3
- package/dist/model/onboardSteps.d.ts +19 -0
- package/dist/model/onboardSteps.js +76 -0
- package/dist/notifications.js +6 -0
- package/dist/ownKey.d.ts +4 -0
- package/dist/ownKey.js +61 -0
- package/dist/pathShape.d.ts +14 -0
- package/dist/pathShape.js +44 -0
- package/dist/planReviewCardFacts.d.ts +3 -0
- package/dist/planReviewCardFacts.js +20 -3
- package/dist/pluginHooksWire.d.ts +20 -8
- package/dist/pluginHooksWire.js +204 -86
- package/dist/prepareRefusal.d.ts +2 -0
- package/dist/prepareRefusal.js +11 -1
- package/dist/request/taskRequest.js +3 -1
- package/dist/resultFrameKeys.d.ts +1 -0
- package/dist/resultFrameKeys.js +3 -0
- package/dist/resumeRefusalCopy.js +3 -1
- package/dist/retryStatus.d.ts +11 -1
- package/dist/retryStatus.js +15 -4
- package/dist/runTerminal.d.ts +1 -0
- package/dist/runTerminal.js +15 -1
- package/dist/sdkWireTransit.d.ts +1 -1
- package/dist/seatContract.d.ts +12 -3
- package/dist/seatContract.js +24 -13
- package/dist/sessionEngine.js +1 -1
- package/dist/sessionHooksRoster.js +8 -6
- package/dist/sessionIdSegment.d.ts +0 -1
- package/dist/sessionIdSegment.js +1 -3
- package/dist/sessionMemoryErase.js +2 -2
- package/dist/sessionMemoryStatus.js +2 -1
- package/dist/sessionOccupant.d.ts +29 -0
- package/dist/sessionOccupant.js +78 -0
- package/dist/settingsHooksSalvage.d.ts +4 -1
- package/dist/settingsHooksSalvage.js +22 -9
- package/dist/skillOverrideChain.d.ts +3 -0
- package/dist/skillOverrideChain.js +31 -4
- package/dist/skillsWireCaps.d.ts +16 -2
- package/dist/skillsWireCaps.js +47 -20
- package/dist/subagent/agentStateDetail.js +32 -8
- package/dist/subagent/engineCompactWire.js +48 -36
- package/dist/subagent/engineDelegatedPrompt.d.ts +3 -2
- package/dist/subagent/engineDelegatedPrompt.js +65 -28
- package/dist/subagentEditOutcomes.d.ts +9 -0
- package/dist/subagentEditOutcomes.js +43 -0
- package/dist/supportFloor.d.ts +2 -1
- package/dist/supportFloor.js +1 -1
- package/dist/toolResult.js +4 -2
- package/dist/toolRoster.d.ts +1 -0
- package/dist/toolRoster.js +1 -0
- package/dist/usageAnalytics.js +2 -1
- package/dist/userAttachmentEnvelope.d.ts +11 -0
- package/dist/userAttachmentEnvelope.js +7 -2
- package/dist/userAttachmentSeat.d.ts +7 -1
- package/dist/userAttachmentSeat.js +44 -7
- package/dist/wiringInstructionsAttribution.js +8 -2
- package/docs/INTEGRATION-CLIENTS.md +1588 -16
- package/package.json +5 -5
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { UserAttachment } from '@sema-agent/sdk';
|
|
2
|
+
import type { UiLanguage } from './env/uiLanguage.js';
|
|
3
|
+
import { type CORE_USER_ATTACHMENT_SUPPLIES } from './generated/engineFactTables.js';
|
|
4
|
+
import { type HumanInputAttachmentDeclinedByView, type HumanInputAttachmentView } from './ownKey.js';
|
|
5
|
+
import type { UserAttachmentRefusalDetail } from './wireRefusalCopy.js';
|
|
6
|
+
export declare const ATTACHMENT_OUTCOMES: readonly ["attached", "partial", "not_attached", "refused", "unknown"];
|
|
7
|
+
export type AttachmentOutcome = (typeof ATTACHMENT_OUTCOMES)[number];
|
|
8
|
+
export type AttachmentSupply = (typeof CORE_USER_ATTACHMENT_SUPPLIES)[number];
|
|
9
|
+
export interface AttachmentOutcomeRow {
|
|
10
|
+
readonly uuid: string;
|
|
11
|
+
readonly outcome: AttachmentOutcome;
|
|
12
|
+
readonly supply: AttachmentSupply;
|
|
13
|
+
readonly engineOutcome?: string;
|
|
14
|
+
readonly kind?: string;
|
|
15
|
+
readonly declinedBy?: HumanInputAttachmentDeclinedByView;
|
|
16
|
+
readonly named?: true;
|
|
17
|
+
}
|
|
18
|
+
export interface AttachmentOutcomesSent {
|
|
19
|
+
readonly userAttachments?: readonly UserAttachment[];
|
|
20
|
+
readonly userAttachmentOrdinals?: readonly string[];
|
|
21
|
+
readonly inputId?: string;
|
|
22
|
+
}
|
|
23
|
+
export interface AttachmentOutcomesReport {
|
|
24
|
+
readonly rows?: readonly HumanInputAttachmentView[];
|
|
25
|
+
readonly refusal?: UserAttachmentRefusalDetail | null;
|
|
26
|
+
readonly inputId?: string;
|
|
27
|
+
}
|
|
28
|
+
export declare function attachmentOutcomesOf(sent: AttachmentOutcomesSent, report: AttachmentOutcomesReport): {
|
|
29
|
+
rows: readonly AttachmentOutcomeRow[];
|
|
30
|
+
refusalNoteFacts?: {
|
|
31
|
+
index: number;
|
|
32
|
+
namedSupply: AttachmentSupply;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
export declare function attachmentOutcomeText(row: AttachmentOutcomeRow, lang?: UiLanguage): string;
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import { USER_ATTACHMENT_INVALID_ERROR_CODE } from './engineErrorCodes.js';
|
|
2
|
+
import { CORE_USER_ATTACHMENT_KINDS } from './generated/engineFactTables.js';
|
|
3
|
+
import { msg, renderMessage } from './i18n/translate.js';
|
|
4
|
+
import { appendOwnElement, guardedRead, humanInputAttachmentsOf, ownDataField, readOwnDataFiniteNumber, readOwnDataNonEmptyString, readOwnDataValue } from './ownKey.js';
|
|
5
|
+
import { showAttachmentName } from './userAttachmentEnvelope.js';
|
|
6
|
+
export const ATTACHMENT_OUTCOMES = Object.freeze(['attached', 'partial', 'not_attached', 'refused', 'unknown']);
|
|
7
|
+
const _engineWordsPinned = true;
|
|
8
|
+
const _contentKindsPinned = true;
|
|
9
|
+
void _engineWordsPinned;
|
|
10
|
+
void _contentKindsPinned;
|
|
11
|
+
const SENT_ENTRIES_MAX = 256;
|
|
12
|
+
const isRecord = (v) => typeof v === 'object' && v !== null && !Array.isArray(v);
|
|
13
|
+
function supplyOf(entry) {
|
|
14
|
+
if (!isRecord(entry))
|
|
15
|
+
return undefined;
|
|
16
|
+
const isPath = typeof readOwnDataValue(entry, 'path') === 'string';
|
|
17
|
+
const isText = typeof readOwnDataValue(entry, 'text') === 'string';
|
|
18
|
+
const image = readOwnDataValue(entry, 'image');
|
|
19
|
+
const isImage = typeof image === 'object' && image !== null;
|
|
20
|
+
if (Number(isPath) + Number(isText) + Number(isImage) !== 1)
|
|
21
|
+
return undefined;
|
|
22
|
+
return isPath ? 'path' : isText ? 'content_text' : 'content_image';
|
|
23
|
+
}
|
|
24
|
+
function sentEntriesOf(sent) {
|
|
25
|
+
try {
|
|
26
|
+
if (!isRecord(sent))
|
|
27
|
+
return [];
|
|
28
|
+
const ua = readOwnDataValue(sent, 'userAttachments');
|
|
29
|
+
const ord = readOwnDataValue(sent, 'userAttachmentOrdinals');
|
|
30
|
+
if (!Array.isArray(ua) || !Array.isArray(ord))
|
|
31
|
+
return [];
|
|
32
|
+
const n = readOwnDataFiniteNumber(ua, 'length');
|
|
33
|
+
const k = readOwnDataFiniteNumber(ord, 'length');
|
|
34
|
+
if (n === undefined || n !== k || !Number.isSafeInteger(n) || n > SENT_ENTRIES_MAX)
|
|
35
|
+
return [];
|
|
36
|
+
const out = [];
|
|
37
|
+
for (let i = 0; i < n; i += 1) {
|
|
38
|
+
const uuid = readOwnDataNonEmptyString(ord, String(i));
|
|
39
|
+
const supply = supplyOf(readOwnDataValue(ua, String(i)));
|
|
40
|
+
if (uuid === undefined || supply === undefined)
|
|
41
|
+
return [];
|
|
42
|
+
appendOwnElement(out, Object.freeze({ uuid, supply }));
|
|
43
|
+
}
|
|
44
|
+
return out;
|
|
45
|
+
}
|
|
46
|
+
catch {
|
|
47
|
+
return [];
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
function refusalReadingOf(refusal) {
|
|
51
|
+
try {
|
|
52
|
+
if (refusal === undefined || refusal === null)
|
|
53
|
+
return { state: 'none' };
|
|
54
|
+
if (!isRecord(refusal) || readOwnDataValue(refusal, 'code') !== USER_ATTACHMENT_INVALID_ERROR_CODE)
|
|
55
|
+
return { state: 'bad' };
|
|
56
|
+
const index = readOwnDataFiniteNumber(refusal, 'index');
|
|
57
|
+
return { state: 'refused', index: index !== undefined && Number.isSafeInteger(index) && index >= 0 ? index : undefined };
|
|
58
|
+
}
|
|
59
|
+
catch {
|
|
60
|
+
return { state: 'bad' };
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
function identityOf(holder) {
|
|
64
|
+
try {
|
|
65
|
+
if (!isRecord(holder))
|
|
66
|
+
return { state: 'absent' };
|
|
67
|
+
const raw = readOwnDataValue(holder, 'inputId');
|
|
68
|
+
if (raw === undefined)
|
|
69
|
+
return { state: 'absent' };
|
|
70
|
+
return typeof raw === 'string' && raw !== '' ? { state: 'id', id: raw } : { state: 'bad' };
|
|
71
|
+
}
|
|
72
|
+
catch {
|
|
73
|
+
return { state: 'bad' };
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
function identityMismatch(a, b) {
|
|
77
|
+
if (a.state === 'bad' || b.state === 'bad')
|
|
78
|
+
return true;
|
|
79
|
+
return a.state === 'id' && b.state === 'id' && a.id !== b.id;
|
|
80
|
+
}
|
|
81
|
+
function engineWordOf(raw) {
|
|
82
|
+
switch (raw) {
|
|
83
|
+
case 'attached':
|
|
84
|
+
return 'attached';
|
|
85
|
+
case 'partial':
|
|
86
|
+
return 'partial';
|
|
87
|
+
case 'not_attached':
|
|
88
|
+
return 'not_attached';
|
|
89
|
+
default:
|
|
90
|
+
return undefined;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
function kindOpposesSupply(kind, supply) {
|
|
94
|
+
if (kind === undefined)
|
|
95
|
+
return false;
|
|
96
|
+
if (kind === 'client_text' || kind === 'client_image')
|
|
97
|
+
return supply === 'path';
|
|
98
|
+
return CORE_USER_ATTACHMENT_KINDS.includes(kind) && supply !== 'path';
|
|
99
|
+
}
|
|
100
|
+
const rowOf = (fields) => Object.freeze(fields);
|
|
101
|
+
const rowsOf = (rows) => Object.freeze(rows);
|
|
102
|
+
const unknownRow = (e) => rowOf({ uuid: e.uuid, outcome: 'unknown', supply: e.supply });
|
|
103
|
+
function rowsFromReport(entries, rows) {
|
|
104
|
+
if (rows === undefined)
|
|
105
|
+
return entries.map(unknownRow);
|
|
106
|
+
for (const r of rows) {
|
|
107
|
+
const at = entries[r.ordinal - 1];
|
|
108
|
+
if (at === undefined || kindOpposesSupply(r.kind, at.supply))
|
|
109
|
+
return entries.map(unknownRow);
|
|
110
|
+
}
|
|
111
|
+
return entries.map((e, i) => {
|
|
112
|
+
const hits = rows.filter((r) => r.ordinal === i + 1);
|
|
113
|
+
const first = hits[0];
|
|
114
|
+
if (first === undefined || hits.some((h) => h.outcome !== first.outcome))
|
|
115
|
+
return unknownRow(e);
|
|
116
|
+
const word = engineWordOf(first.outcome);
|
|
117
|
+
if (word === undefined)
|
|
118
|
+
return rowOf({ uuid: e.uuid, outcome: 'unknown', supply: e.supply, engineOutcome: first.outcome, ...(first.kind !== undefined ? { kind: first.kind } : {}) });
|
|
119
|
+
return rowOf({
|
|
120
|
+
uuid: e.uuid,
|
|
121
|
+
outcome: word,
|
|
122
|
+
supply: e.supply,
|
|
123
|
+
...(first.kind !== undefined ? { kind: first.kind } : {}),
|
|
124
|
+
...(word === 'not_attached' && first.declinedBy !== undefined ? { declinedBy: first.declinedBy } : {}),
|
|
125
|
+
});
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
export function attachmentOutcomesOf(sent, report) {
|
|
129
|
+
try {
|
|
130
|
+
const entries = sentEntriesOf(sent);
|
|
131
|
+
if (entries.length === 0)
|
|
132
|
+
return Object.freeze({ rows: rowsOf([]) });
|
|
133
|
+
let rawRefusal;
|
|
134
|
+
try {
|
|
135
|
+
rawRefusal = isRecord(report) ? ownDataField(report, 'refusal') : undefined;
|
|
136
|
+
}
|
|
137
|
+
catch {
|
|
138
|
+
return Object.freeze({ rows: rowsOf(entries.map(unknownRow)) });
|
|
139
|
+
}
|
|
140
|
+
const refusal = refusalReadingOf(rawRefusal);
|
|
141
|
+
if (refusal.state === 'bad')
|
|
142
|
+
return Object.freeze({ rows: rowsOf(entries.map(unknownRow)) });
|
|
143
|
+
if (refusal.state === 'refused') {
|
|
144
|
+
const { index } = refusal;
|
|
145
|
+
const rows = rowsOf(entries.map((e, i) => rowOf({ uuid: e.uuid, outcome: 'refused', supply: e.supply, ...(i === index ? { named: true } : {}) })));
|
|
146
|
+
const named = index === undefined ? undefined : entries[index];
|
|
147
|
+
return index !== undefined && named !== undefined ? Object.freeze({ rows, refusalNoteFacts: Object.freeze({ index, namedSupply: named.supply }) }) : Object.freeze({ rows });
|
|
148
|
+
}
|
|
149
|
+
if (identityMismatch(identityOf(sent), identityOf(report)))
|
|
150
|
+
return Object.freeze({ rows: rowsOf(entries.map(unknownRow)) });
|
|
151
|
+
const raw = guardedRead(() => (isRecord(report) ? readOwnDataValue(report, 'rows') : undefined));
|
|
152
|
+
const read = raw === undefined ? undefined : humanInputAttachmentsOf({ attachments: raw });
|
|
153
|
+
return Object.freeze({ rows: rowsOf(rowsFromReport(entries, read)) });
|
|
154
|
+
}
|
|
155
|
+
catch {
|
|
156
|
+
return Object.freeze({ rows: rowsOf([]) });
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
function outcomeOfRow(row) {
|
|
160
|
+
const raw = guardedRead(() => (isRecord(row) ? readOwnDataNonEmptyString(row, 'outcome') : undefined));
|
|
161
|
+
return ATTACHMENT_OUTCOMES.find((w) => w === raw) ?? 'unknown';
|
|
162
|
+
}
|
|
163
|
+
function namedOfRow(row) {
|
|
164
|
+
return guardedRead(() => (isRecord(row) ? readOwnDataValue(row, 'named') === true : undefined)) === true;
|
|
165
|
+
}
|
|
166
|
+
function declinerNameOf(row) {
|
|
167
|
+
return guardedRead(() => {
|
|
168
|
+
const d = isRecord(row) ? readOwnDataValue(row, 'declinedBy') : undefined;
|
|
169
|
+
return isRecord(d) && readOwnDataValue(d, 'kind') === 'extension' ? readOwnDataNonEmptyString(d, 'name') : undefined;
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
export function attachmentOutcomeText(row, lang) {
|
|
173
|
+
try {
|
|
174
|
+
switch (outcomeOfRow(row)) {
|
|
175
|
+
case 'attached':
|
|
176
|
+
return renderMessage(msg('attachments.outcome.attached.row'), lang);
|
|
177
|
+
case 'partial':
|
|
178
|
+
return renderMessage(msg('attachments.outcome.partial.row'), lang);
|
|
179
|
+
case 'not_attached': {
|
|
180
|
+
const name = declinerNameOf(row);
|
|
181
|
+
return name !== undefined ? renderMessage(msg('attachments.outcome.notAttachedDeclined.row', { name: showAttachmentName(name) }), lang) : renderMessage(msg('attachments.outcome.notAttached.row'), lang);
|
|
182
|
+
}
|
|
183
|
+
case 'refused':
|
|
184
|
+
return namedOfRow(row) ? renderMessage(msg('attachments.outcome.refusedNamed.row'), lang) : renderMessage(msg('attachments.outcome.refused.row'), lang);
|
|
185
|
+
default:
|
|
186
|
+
return renderMessage(msg('attachments.outcome.unknown.row'), lang);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
catch {
|
|
190
|
+
return renderMessage(msg('attachments.outcome.unknown.row'), lang);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import type { UserAttachment } from '@sema-agent/sdk';
|
|
2
|
+
import type { UserAttachmentSeatLimits, UserAttachmentSeatReading } from './userAttachmentSeat.js';
|
|
3
|
+
import type { UiLanguage } from './env/uiLanguage.js';
|
|
4
|
+
import { type AttachmentRouteLeg, type AttachmentWithheldReason, type ToolsLocation } from './attachmentRoute.js';
|
|
5
|
+
export type UserAttachmentPathEntry = Extract<UserAttachment, {
|
|
6
|
+
path: string;
|
|
7
|
+
}>;
|
|
8
|
+
export type AttachmentPathOverflow = 'seat_count' | 'lines_invalid' | 'path_invalid';
|
|
9
|
+
export type AttachmentPathPlan = {
|
|
10
|
+
readonly admitted: readonly {
|
|
11
|
+
readonly uuid: string;
|
|
12
|
+
readonly entry: UserAttachmentPathEntry;
|
|
13
|
+
}[];
|
|
14
|
+
readonly overflow: readonly {
|
|
15
|
+
readonly uuid: string;
|
|
16
|
+
readonly why: AttachmentPathOverflow;
|
|
17
|
+
}[];
|
|
18
|
+
} | {
|
|
19
|
+
readonly reject: 'malformed_input' | 'duplicate_uuid';
|
|
20
|
+
};
|
|
21
|
+
export type PathEntryVerdict = {
|
|
22
|
+
readonly entry: UserAttachmentPathEntry;
|
|
23
|
+
} | {
|
|
24
|
+
readonly why: 'path_invalid' | 'lines_invalid';
|
|
25
|
+
};
|
|
26
|
+
export declare function pathEntryOf(o: object): PathEntryVerdict;
|
|
27
|
+
export declare function presentSeatLimitsOf(reading: UserAttachmentSeatReading | {} | null | undefined): UserAttachmentSeatLimits | undefined;
|
|
28
|
+
export declare function attachmentPathPlanOf(input: {
|
|
29
|
+
readonly seat?: UserAttachmentSeatReading | undefined;
|
|
30
|
+
readonly candidates: readonly (UserAttachmentPathEntry & {
|
|
31
|
+
readonly uuid: string;
|
|
32
|
+
})[];
|
|
33
|
+
}): AttachmentPathPlan;
|
|
34
|
+
export declare function attachmentPathOverflowText(why: AttachmentPathOverflow, lang?: UiLanguage): string | undefined;
|
|
35
|
+
export interface AttachmentRouteBatch {
|
|
36
|
+
readonly toolsLocation: ToolsLocation;
|
|
37
|
+
readonly seat?: UserAttachmentSeatReading;
|
|
38
|
+
readonly scenario?: {} | null;
|
|
39
|
+
readonly lane: 'objective' | 'steer';
|
|
40
|
+
readonly items: readonly ({
|
|
41
|
+
readonly uuid: string;
|
|
42
|
+
readonly leg: AttachmentRouteLeg;
|
|
43
|
+
} & Partial<UserAttachmentPathEntry>)[];
|
|
44
|
+
}
|
|
45
|
+
export type AttachmentRouteStep = {
|
|
46
|
+
readonly uuid: string;
|
|
47
|
+
readonly action: 'send_path';
|
|
48
|
+
readonly entry: UserAttachmentPathEntry;
|
|
49
|
+
} | {
|
|
50
|
+
readonly uuid: string;
|
|
51
|
+
readonly action: 'read_local';
|
|
52
|
+
readonly localCopy: boolean;
|
|
53
|
+
readonly pathFallback?: AttachmentPathOverflow;
|
|
54
|
+
} | {
|
|
55
|
+
readonly uuid: string;
|
|
56
|
+
readonly action: 'withhold';
|
|
57
|
+
readonly reason: AttachmentWithheldReason;
|
|
58
|
+
readonly pathFallback?: AttachmentPathOverflow;
|
|
59
|
+
};
|
|
60
|
+
export type AttachmentRoutePlan = {
|
|
61
|
+
readonly ok: true;
|
|
62
|
+
readonly steps: readonly AttachmentRouteStep[];
|
|
63
|
+
} | {
|
|
64
|
+
readonly ok: false;
|
|
65
|
+
readonly reject: 'malformed_input' | 'duplicate_uuid';
|
|
66
|
+
};
|
|
67
|
+
export declare function attachmentRoutePlanOf(batch: AttachmentRouteBatch): AttachmentRoutePlan;
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import { CORE_USER_ATTACHMENT_LABEL_MAX } from './generated/engineFactTables.js';
|
|
2
|
+
import { appendOwnElement } from './ownKey.js';
|
|
3
|
+
import { attachmentRouteOf } from './attachmentRoute.js';
|
|
4
|
+
import { msg, renderMessage } from './i18n/translate.js';
|
|
5
|
+
function isPlainObject(x) {
|
|
6
|
+
if (x === null || typeof x !== 'object' || Array.isArray(x))
|
|
7
|
+
return false;
|
|
8
|
+
const p = Object.getPrototypeOf(x);
|
|
9
|
+
return p === Object.prototype || p === null;
|
|
10
|
+
}
|
|
11
|
+
function slotOf(o, key) {
|
|
12
|
+
try {
|
|
13
|
+
const d = Object.getOwnPropertyDescriptor(o, key);
|
|
14
|
+
if (d === undefined)
|
|
15
|
+
return { value: undefined };
|
|
16
|
+
return Object.hasOwn(d, 'value') ? { value: d.value } : undefined;
|
|
17
|
+
}
|
|
18
|
+
catch {
|
|
19
|
+
return undefined;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
const positiveSafeInt = (v) => typeof v === 'number' && Number.isSafeInteger(v) && v >= 1;
|
|
23
|
+
export function pathEntryOf(o) {
|
|
24
|
+
const pathSlot = slotOf(o, 'path');
|
|
25
|
+
const path = pathSlot?.value;
|
|
26
|
+
if (typeof path !== 'string' || path.length === 0 || path.length > CORE_USER_ATTACHMENT_LABEL_MAX)
|
|
27
|
+
return { why: 'path_invalid' };
|
|
28
|
+
const linesSlot = slotOf(o, 'lines');
|
|
29
|
+
if (linesSlot === undefined)
|
|
30
|
+
return { why: 'lines_invalid' };
|
|
31
|
+
const lines = linesSlot.value;
|
|
32
|
+
if (lines === undefined)
|
|
33
|
+
return { entry: { path } };
|
|
34
|
+
if (!isPlainObject(lines))
|
|
35
|
+
return { why: 'lines_invalid' };
|
|
36
|
+
const start = slotOf(lines, 'start')?.value;
|
|
37
|
+
const endSlot = slotOf(lines, 'end');
|
|
38
|
+
if (!positiveSafeInt(start) || endSlot === undefined)
|
|
39
|
+
return { why: 'lines_invalid' };
|
|
40
|
+
const end = endSlot.value;
|
|
41
|
+
if (end === undefined)
|
|
42
|
+
return { entry: { path, lines: { start } } };
|
|
43
|
+
if (!positiveSafeInt(end) || end < start)
|
|
44
|
+
return { why: 'lines_invalid' };
|
|
45
|
+
return { entry: { path, lines: { start, end } } };
|
|
46
|
+
}
|
|
47
|
+
export function presentSeatLimitsOf(reading) {
|
|
48
|
+
try {
|
|
49
|
+
if (reading === null || typeof reading !== 'object' || Array.isArray(reading))
|
|
50
|
+
return undefined;
|
|
51
|
+
if (slotOf(reading, 'kind')?.value !== 'present')
|
|
52
|
+
return undefined;
|
|
53
|
+
const limits = slotOf(reading, 'limits')?.value;
|
|
54
|
+
if (!isPlainObject(limits))
|
|
55
|
+
return undefined;
|
|
56
|
+
const maxEntries = slotOf(limits, 'maxEntries')?.value;
|
|
57
|
+
const maxRenderedTextChars = slotOf(limits, 'maxRenderedTextChars')?.value;
|
|
58
|
+
return positiveSafeInt(maxEntries) && positiveSafeInt(maxRenderedTextChars) ? { maxEntries, maxRenderedTextChars } : undefined;
|
|
59
|
+
}
|
|
60
|
+
catch {
|
|
61
|
+
return undefined;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
function ownElements(x) {
|
|
65
|
+
try {
|
|
66
|
+
if (!Array.isArray(x))
|
|
67
|
+
return undefined;
|
|
68
|
+
const n = slotOf(x, 'length')?.value;
|
|
69
|
+
if (typeof n !== 'number' || !Number.isSafeInteger(n) || n < 0)
|
|
70
|
+
return undefined;
|
|
71
|
+
const out = [];
|
|
72
|
+
for (let i = 0; i < n; i += 1) {
|
|
73
|
+
const d = Object.getOwnPropertyDescriptor(x, i);
|
|
74
|
+
if (d === undefined || !Object.hasOwn(d, 'value'))
|
|
75
|
+
return undefined;
|
|
76
|
+
appendOwnElement(out, d.value);
|
|
77
|
+
}
|
|
78
|
+
return out;
|
|
79
|
+
}
|
|
80
|
+
catch {
|
|
81
|
+
return undefined;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
export function attachmentPathPlanOf(input) {
|
|
85
|
+
try {
|
|
86
|
+
if (!isPlainObject(input))
|
|
87
|
+
return { reject: 'malformed_input' };
|
|
88
|
+
const seatSlot = slotOf(input, 'seat');
|
|
89
|
+
const limits = seatSlot === undefined ? undefined : presentSeatLimitsOf(seatSlot.value);
|
|
90
|
+
const candidatesSlot = slotOf(input, 'candidates');
|
|
91
|
+
const raw = candidatesSlot === undefined ? undefined : ownElements(candidatesSlot.value);
|
|
92
|
+
if (raw === undefined)
|
|
93
|
+
return { reject: 'malformed_input' };
|
|
94
|
+
const read = [];
|
|
95
|
+
const seen = new Set();
|
|
96
|
+
for (const c of raw) {
|
|
97
|
+
if (!isPlainObject(c))
|
|
98
|
+
return { reject: 'malformed_input' };
|
|
99
|
+
const uuid = slotOf(c, 'uuid')?.value;
|
|
100
|
+
if (typeof uuid !== 'string' || uuid.length === 0)
|
|
101
|
+
return { reject: 'malformed_input' };
|
|
102
|
+
if (seen.has(uuid))
|
|
103
|
+
return { reject: 'duplicate_uuid' };
|
|
104
|
+
seen.add(uuid);
|
|
105
|
+
read.push({ uuid, verdict: pathEntryOf(c) });
|
|
106
|
+
}
|
|
107
|
+
const admitted = [];
|
|
108
|
+
const overflow = [];
|
|
109
|
+
for (const { uuid, verdict } of read) {
|
|
110
|
+
if ('why' in verdict)
|
|
111
|
+
appendOwnElement(overflow, { uuid, why: verdict.why });
|
|
112
|
+
else if (admitted.length >= (limits?.maxEntries ?? 0))
|
|
113
|
+
appendOwnElement(overflow, { uuid, why: 'seat_count' });
|
|
114
|
+
else
|
|
115
|
+
appendOwnElement(admitted, { uuid, entry: verdict.entry });
|
|
116
|
+
}
|
|
117
|
+
return { admitted, overflow };
|
|
118
|
+
}
|
|
119
|
+
catch {
|
|
120
|
+
return { reject: 'malformed_input' };
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
const OVERFLOW_ROW_KEYS = {
|
|
124
|
+
seat_count: 'attachments.pathOverflow.seatCount.row',
|
|
125
|
+
lines_invalid: 'attachments.pathOverflow.linesInvalid.row',
|
|
126
|
+
path_invalid: 'attachments.pathOverflow.pathInvalid.row',
|
|
127
|
+
};
|
|
128
|
+
export function attachmentPathOverflowText(why, lang) {
|
|
129
|
+
if (typeof why !== 'string' || !Object.hasOwn(OVERFLOW_ROW_KEYS, why))
|
|
130
|
+
return undefined;
|
|
131
|
+
return renderMessage(msg(OVERFLOW_ROW_KEYS[why]), lang);
|
|
132
|
+
}
|
|
133
|
+
function rejectPlan(reject) {
|
|
134
|
+
const plan = { ok: false, reject };
|
|
135
|
+
return Object.freeze(plan);
|
|
136
|
+
}
|
|
137
|
+
function fallbackStep(uuid, fallback, why) {
|
|
138
|
+
const tail = why === undefined ? {} : { pathFallback: why };
|
|
139
|
+
const step = fallback.route === 'attach_content' ? { uuid, action: 'read_local', localCopy: fallback.localCopy, ...tail } : { uuid, action: 'withhold', reason: fallback.reason, ...tail };
|
|
140
|
+
return Object.freeze(step);
|
|
141
|
+
}
|
|
142
|
+
const valueOf = (slot) => slot?.value;
|
|
143
|
+
function factsOf(leg, toolsLocation, seat, scenario, lane) {
|
|
144
|
+
return {
|
|
145
|
+
leg: leg,
|
|
146
|
+
toolsLocation: toolsLocation,
|
|
147
|
+
...(seat !== undefined ? { seat: seat } : {}),
|
|
148
|
+
...(scenario !== undefined ? { scenario: scenario } : {}),
|
|
149
|
+
...(lane !== undefined ? { lane: lane } : {}),
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
export function attachmentRoutePlanOf(batch) {
|
|
153
|
+
try {
|
|
154
|
+
if (!isPlainObject(batch))
|
|
155
|
+
return rejectPlan('malformed_input');
|
|
156
|
+
const itemsSlot = slotOf(batch, 'items');
|
|
157
|
+
const raw = itemsSlot === undefined ? undefined : ownElements(itemsSlot.value);
|
|
158
|
+
if (raw === undefined)
|
|
159
|
+
return rejectPlan('malformed_input');
|
|
160
|
+
const toolsLocation = valueOf(slotOf(batch, 'toolsLocation'));
|
|
161
|
+
const seat = valueOf(slotOf(batch, 'seat'));
|
|
162
|
+
const scenario = valueOf(slotOf(batch, 'scenario'));
|
|
163
|
+
const lane = valueOf(slotOf(batch, 'lane'));
|
|
164
|
+
const read = [];
|
|
165
|
+
const seen = new Set();
|
|
166
|
+
for (const it of raw) {
|
|
167
|
+
if (!isPlainObject(it))
|
|
168
|
+
return rejectPlan('malformed_input');
|
|
169
|
+
const uuid = slotOf(it, 'uuid')?.value;
|
|
170
|
+
if (typeof uuid !== 'string' || uuid.length === 0)
|
|
171
|
+
return rejectPlan('malformed_input');
|
|
172
|
+
if (seen.has(uuid))
|
|
173
|
+
return rejectPlan('duplicate_uuid');
|
|
174
|
+
seen.add(uuid);
|
|
175
|
+
const linesSlot = slotOf(it, 'lines');
|
|
176
|
+
read.push({ uuid, leg: slotOf(it, 'leg')?.value, candidate: { uuid, path: slotOf(it, 'path')?.value, lines: linesSlot === undefined ? null : linesSlot.value } });
|
|
177
|
+
}
|
|
178
|
+
const routes = read.map((r) => attachmentRouteOf(factsOf(r.leg, toolsLocation, seat, scenario, lane)));
|
|
179
|
+
const toPlan = read.filter((_, i) => routes[i]?.route === 'attach_path').map((r) => r.candidate);
|
|
180
|
+
const plan = attachmentPathPlanOf({ ...(seat !== undefined ? { seat: seat } : {}), candidates: toPlan });
|
|
181
|
+
if ('reject' in plan)
|
|
182
|
+
return rejectPlan('malformed_input');
|
|
183
|
+
const admitted = new Map(plan.admitted.map((a) => [a.uuid, a.entry]));
|
|
184
|
+
const overflow = new Map(plan.overflow.map((o) => [o.uuid, o.why]));
|
|
185
|
+
const steps = read.map((r, i) => {
|
|
186
|
+
const route = routes[i];
|
|
187
|
+
if (route.route !== 'attach_path')
|
|
188
|
+
return fallbackStep(r.uuid, route, undefined);
|
|
189
|
+
const entry = admitted.get(r.uuid);
|
|
190
|
+
if (entry === undefined)
|
|
191
|
+
return fallbackStep(r.uuid, route.otherwise, overflow.get(r.uuid));
|
|
192
|
+
if (entry.lines !== undefined)
|
|
193
|
+
Object.freeze(entry.lines);
|
|
194
|
+
const step = { uuid: r.uuid, action: 'send_path', entry: Object.freeze(entry) };
|
|
195
|
+
return Object.freeze(step);
|
|
196
|
+
});
|
|
197
|
+
const done = { ok: true, steps: Object.freeze(steps) };
|
|
198
|
+
return Object.freeze(done);
|
|
199
|
+
}
|
|
200
|
+
catch {
|
|
201
|
+
return rejectPlan('malformed_input');
|
|
202
|
+
}
|
|
203
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { UiLanguage } from './env/uiLanguage.js';
|
|
2
|
+
import { type UserAttachmentSeatReading } from './userAttachmentSeat.js';
|
|
2
3
|
export declare const TOOLS_LOCATIONS: readonly ["this-machine", "elsewhere", "unconfirmed"];
|
|
3
4
|
export type ToolsLocation = (typeof TOOLS_LOCATIONS)[number];
|
|
4
5
|
export declare const ATTACHMENT_ROUTE_LEGS: readonly ["at_mention", "edited_file", "paste", "ide_selection"];
|
|
@@ -6,15 +7,22 @@ export type AttachmentRouteLeg = (typeof ATTACHMENT_ROUTE_LEGS)[number];
|
|
|
6
7
|
export interface AttachmentRouteFacts {
|
|
7
8
|
readonly leg: AttachmentRouteLeg;
|
|
8
9
|
readonly toolsLocation: ToolsLocation;
|
|
10
|
+
readonly seat?: UserAttachmentSeatReading;
|
|
11
|
+
readonly scenario?: {} | null;
|
|
12
|
+
readonly lane?: 'objective' | 'steer';
|
|
9
13
|
}
|
|
10
14
|
export type AttachmentWithheldReason = 'tools-elsewhere' | 'tools-location-unconfirmed';
|
|
11
|
-
export type
|
|
15
|
+
export type AttachmentRouteFallback = {
|
|
12
16
|
readonly route: 'attach_content';
|
|
13
17
|
readonly localCopy: boolean;
|
|
14
18
|
} | {
|
|
15
19
|
readonly route: 'withhold';
|
|
16
20
|
readonly reason: AttachmentWithheldReason;
|
|
17
21
|
};
|
|
22
|
+
export type AttachmentRoute = AttachmentRouteFallback | {
|
|
23
|
+
readonly route: 'attach_path';
|
|
24
|
+
readonly otherwise: AttachmentRouteFallback;
|
|
25
|
+
};
|
|
18
26
|
export declare function attachmentRouteOf(facts: AttachmentRouteFacts): AttachmentRoute;
|
|
19
27
|
export declare function attachmentWithheldReasonText(reason: AttachmentWithheldReason, lang?: UiLanguage): string;
|
|
20
28
|
export declare function attachmentLocalCopyNote(): string;
|
package/dist/attachmentRoute.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { msg, renderMessage } from './i18n/translate.js';
|
|
2
|
-
import { readOwnDataNonEmptyString } from './ownKey.js';
|
|
2
|
+
import { readOwnDataNonEmptyString, readOwnDataValue } from './ownKey.js';
|
|
3
|
+
import { userAttachmentSeatAdmits } from './userAttachmentSeat.js';
|
|
3
4
|
export const TOOLS_LOCATIONS = Object.freeze(['this-machine', 'elsewhere', 'unconfirmed']);
|
|
4
5
|
export const ATTACHMENT_ROUTE_LEGS = Object.freeze(['at_mention', 'edited_file', 'paste', 'ide_selection']);
|
|
5
6
|
const _withheldReasonsPinned = true;
|
|
@@ -8,6 +9,8 @@ const ATTACH = Object.freeze({ route: 'attach_content', localCopy: false });
|
|
|
8
9
|
const ATTACH_LOCAL_COPY = Object.freeze({ route: 'attach_content', localCopy: true });
|
|
9
10
|
const WITHHOLD_ELSEWHERE = Object.freeze({ route: 'withhold', reason: 'tools-elsewhere' });
|
|
10
11
|
const WITHHOLD_UNCONFIRMED = Object.freeze({ route: 'withhold', reason: 'tools-location-unconfirmed' });
|
|
12
|
+
const PATH_OR_WITHHOLD_ELSEWHERE = Object.freeze({ route: 'attach_path', otherwise: WITHHOLD_ELSEWHERE });
|
|
13
|
+
const PATH_OR_WITHHOLD_UNCONFIRMED = Object.freeze({ route: 'attach_path', otherwise: WITHHOLD_UNCONFIRMED });
|
|
11
14
|
const SNAPSHOT_LEGS = new Set(['paste', 'ide_selection']);
|
|
12
15
|
function closedWord(facts, key, words) {
|
|
13
16
|
try {
|
|
@@ -20,6 +23,21 @@ function closedWord(facts, key, words) {
|
|
|
20
23
|
return undefined;
|
|
21
24
|
}
|
|
22
25
|
}
|
|
26
|
+
function enginePathAdmitted(facts) {
|
|
27
|
+
try {
|
|
28
|
+
if (typeof facts !== 'object' || facts === null)
|
|
29
|
+
return false;
|
|
30
|
+
const seat = readOwnDataValue(facts, 'seat');
|
|
31
|
+
if (seat === undefined)
|
|
32
|
+
return false;
|
|
33
|
+
const scenario = readOwnDataValue(facts, 'scenario');
|
|
34
|
+
const lane = readOwnDataValue(facts, 'lane');
|
|
35
|
+
return userAttachmentSeatAdmits(seat, { supply: 'path', ...(scenario === undefined ? {} : { scenario }), ...(lane === undefined ? {} : { lane }) }) === 'yes';
|
|
36
|
+
}
|
|
37
|
+
catch {
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
23
41
|
export function attachmentRouteOf(facts) {
|
|
24
42
|
const where = closedWord(facts, 'toolsLocation', TOOLS_LOCATIONS);
|
|
25
43
|
if (where === 'this-machine')
|
|
@@ -27,7 +45,10 @@ export function attachmentRouteOf(facts) {
|
|
|
27
45
|
const leg = closedWord(facts, 'leg', ATTACHMENT_ROUTE_LEGS);
|
|
28
46
|
if (leg !== undefined && SNAPSHOT_LEGS.has(leg))
|
|
29
47
|
return ATTACH_LOCAL_COPY;
|
|
30
|
-
|
|
48
|
+
const elsewhere = where === 'elsewhere';
|
|
49
|
+
if (leg === 'at_mention' && enginePathAdmitted(facts))
|
|
50
|
+
return elsewhere ? PATH_OR_WITHHOLD_ELSEWHERE : PATH_OR_WITHHOLD_UNCONFIRMED;
|
|
51
|
+
return elsewhere ? WITHHOLD_ELSEWHERE : WITHHOLD_UNCONFIRMED;
|
|
31
52
|
}
|
|
32
53
|
export function attachmentWithheldReasonText(reason, lang) {
|
|
33
54
|
return reason === 'tools-elsewhere'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const DECLARED_SUPPORT_FLOOR: Readonly<Record<"server" | "core" | "sdk", string>>;
|
|
1
|
+
export declare const DECLARED_SUPPORT_FLOOR: Readonly<Record<"server" | "core" | "sdk" | "settingsContract", string>>;
|
package/dist/deviceRebind.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { atMostOnceVerdictOf } from './atMostOnce.js';
|
|
2
2
|
import { readOwnDataValue } from './ownKey.js';
|
|
3
|
-
import { LIMIT_RATE_EXCEEDED } from './engineErrorCodes.js';
|
|
3
|
+
import { LIMIT_RATE_EXCEEDED, ROUTE_NOT_FOUND } from './engineErrorCodes.js';
|
|
4
4
|
import { isDisplayableWireCode, readErrorString, readErrorStrictStringList, readThrownSlot, wireFailureShapeOf } from './wireFailureShape.js';
|
|
5
5
|
import { EXECUTION_PLACEMENT_DEVICE_LANE, EXECUTION_PLACEMENT_ROLES } from './executionPlacementWords.js';
|
|
6
6
|
const LANE_ABSENT = 'capability.device_lane_required';
|
|
@@ -8,7 +8,6 @@ const RUN_STORE_ABSENT = 'capability.run_store_required';
|
|
|
8
8
|
const NOT_FOUND = 'not_found.device';
|
|
9
9
|
const ACTIVE_RUN = 'device.rebind_active_run';
|
|
10
10
|
const SESSION_NOT_FOUND = 'not_found.session';
|
|
11
|
-
const ROUTE_ABSENT = 'not_found.route';
|
|
12
11
|
const SESSION_STORE_ABSENT = 'capability.session_store_required';
|
|
13
12
|
const REV_CONFLICT = 'device.rebind_rev_conflict';
|
|
14
13
|
const SERVICE_TOKEN_REQUIRED = 'auth.service_token_required';
|
|
@@ -134,7 +133,7 @@ function placementReadFailureOf(e) {
|
|
|
134
133
|
const v = atMostOnceVerdictOf(e);
|
|
135
134
|
if (v.status === 404 && v.code === SESSION_NOT_FOUND)
|
|
136
135
|
return { kind: 'not-found' };
|
|
137
|
-
if (v.status === 404 && v.code ===
|
|
136
|
+
if (v.status === 404 && v.code === ROUTE_NOT_FOUND)
|
|
138
137
|
return { kind: 'unsupported', reason: 'route' };
|
|
139
138
|
if (v.status === 501 && v.code === SESSION_STORE_ABSENT)
|
|
140
139
|
return { kind: 'unsupported', reason: 'capability' };
|