@sema-agent/client-core 0.105.0 → 0.107.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 +301 -0
- package/README.md +40 -21
- package/dist/adapt/arms.js +10 -1
- package/dist/adapter/activeRunSelfHeal.d.ts +21 -2
- package/dist/adapter/activeRunSelfHeal.js +129 -28
- package/dist/adapter/downstream/eventToSdkMessage.d.ts +0 -5
- package/dist/adapter/downstream/eventToSdkMessage.js +20 -19
- package/dist/adapter/downstream/terminalToSdkResult.js +2 -3
- package/dist/adapter/downstream/wiringManifestView.d.ts +1 -3
- package/dist/adapter/downstream/wiringManifestView.js +0 -1
- package/dist/adapter/runStream.js +3 -4
- package/dist/approvalReachWire.d.ts +1 -0
- package/dist/approvalReachWire.js +4 -1
- package/dist/approvalSeat.d.ts +21 -0
- package/dist/approvalSeat.js +73 -0
- package/dist/assistantInbox.d.ts +2 -0
- package/dist/assistantInbox.js +3 -0
- package/dist/checkpointRowVerdict.d.ts +29 -0
- package/dist/checkpointRowVerdict.js +98 -0
- package/dist/coreValuePorts.d.ts +12 -1
- package/dist/coreValuePorts.js +10 -0
- package/dist/decideFailureNote.js +3 -1
- package/dist/decideReceipt.d.ts +9 -0
- package/dist/decideReceipt.js +29 -1
- package/dist/declared/supportFloorDeclared.js +2 -2
- package/dist/deviceRebind.d.ts +7 -0
- package/dist/deviceRebind.js +39 -5
- package/dist/displayUntrusted.d.ts +5 -3
- package/dist/displayUntrusted.js +50 -41
- package/dist/engineAddress.d.ts +3 -0
- package/dist/engineAddress.js +25 -0
- package/dist/engineDirectory.js +9 -17
- package/dist/engineErrorCodes.d.ts +8 -0
- package/dist/engineErrorCodes.js +8 -0
- package/dist/engineNoticeCodes.d.ts +38 -3
- package/dist/engineNoticeCodes.js +167 -11
- package/dist/engineRowRef.js +1 -1
- package/dist/errorSupplementRoles.js +4 -1
- package/dist/eventLeg.d.ts +2 -2
- package/dist/eventLeg.js +2 -1
- package/dist/executionLaneCapability.js +3 -2
- package/dist/executionLaneWords.d.ts +1 -0
- package/dist/executionLaneWords.js +3 -0
- package/dist/fleet/fleetProjection.js +26 -5
- package/dist/generated/engineFactTables.d.ts +2 -1
- package/dist/generated/engineFactTables.js +3 -1
- package/dist/generated/engineNoticeTables.js +28 -7
- package/dist/generated/sdkFactTables.d.ts +3 -0
- package/dist/generated/sdkFactTables.js +15 -0
- package/dist/generated/settingsSchemaFns.d.ts +11 -0
- package/dist/generated/settingsSchemaFns.js +2 -1
- package/dist/generated/settingsSchemaSafetyMergeSpec.js +1 -1
- package/dist/generated/settingsSchemaSettingsSources.d.ts +1 -1
- package/dist/generated/settingsSchemaSettingsSources.js +22 -2
- package/dist/hitl/approvalLiveFace.d.ts +17 -0
- package/dist/hitl/approvalLiveFace.js +35 -0
- package/dist/hitl/approvalQueueRow.d.ts +21 -0
- package/dist/hitl/approvalQueueRow.js +69 -0
- package/dist/hitl/approvalResolution.d.ts +5 -1
- package/dist/hitl/approvalResolution.js +18 -1
- package/dist/hitl/approvalsFeed.d.ts +5 -4
- package/dist/hitl/approvalsFeed.js +39 -6
- package/dist/hitl/askParkRowRouting.d.ts +4 -3
- package/dist/hitl/askParkRowRouting.js +27 -3
- package/dist/hitl/automaticAnswerVerdict.js +13 -10
- package/dist/hitl/crashConverged.d.ts +5 -1
- package/dist/hitl/decisionConflict.js +2 -1
- package/dist/hitl/decisionRefusal.js +1 -1
- package/dist/hitl/decisionSend.d.ts +3 -0
- package/dist/hitl/decisionSend.js +32 -6
- package/dist/hitl/frameRouter.js +4 -5
- package/dist/hitl/hitlBridge.d.ts +6 -2
- package/dist/hitl/hitlBridge.js +53 -7
- package/dist/hitl/livePendingAsk.d.ts +5 -0
- package/dist/hitl/livePendingAsk.js +10 -3
- package/dist/hitl/parkOwnership.js +4 -5
- package/dist/hitl/parkResolver.js +9 -5
- package/dist/hitl/parkRowBirthWait.d.ts +7 -0
- package/dist/hitl/parkRowBirthWait.js +1 -1
- package/dist/hitl/parkRowDelegation.d.ts +6 -0
- package/dist/hitl/parkRowDelegation.js +33 -0
- package/dist/hitl/persistedRulesWire.d.ts +15 -3
- package/dist/hitl/persistedRulesWire.js +102 -20
- package/dist/hitl/planReviewCard.d.ts +2 -0
- package/dist/hitl/planReviewCard.js +21 -0
- package/dist/hitl/planReviewWire.d.ts +2 -2
- package/dist/hitl/planReviewWire.js +105 -38
- package/dist/hitl/sessionAllowRoute.d.ts +7 -0
- package/dist/hitl/sessionAllowRoute.js +49 -0
- package/dist/hitl/sessionPolicyWire.d.ts +1 -7
- package/dist/hitl/sessionPolicyWire.js +3 -43
- package/dist/hitl/standingRows.js +10 -10
- package/dist/hitl/subagentSource.d.ts +1 -0
- package/dist/hitl/subagentSource.js +13 -0
- package/dist/hitl/toolApprovalWire.d.ts +3 -2
- package/dist/hitl/toolApprovalWire.js +100 -44
- package/dist/hostSettingsSource.d.ts +4 -1
- package/dist/hostSettingsSource.js +11 -6
- package/dist/hostTurnSettings.d.ts +4 -5
- package/dist/hostTurnSettings.js +80 -19
- package/dist/i18n/messages.en.d.ts +41 -12
- package/dist/i18n/messages.en.js +42 -13
- package/dist/i18n/messages.zh.js +45 -13
- package/dist/index.d.ts +22 -2
- package/dist/index.js +12 -2
- package/dist/injectionLaneNotice.js +2 -1
- package/dist/liveInitToolFace.js +0 -1
- package/dist/liveModelCatalog.d.ts +15 -0
- package/dist/liveModelCatalog.js +40 -0
- package/dist/mcpWireCaps.js +1 -1
- package/dist/modelCapabilityProbe.js +66 -33
- package/dist/noticePresentation.js +2 -0
- package/dist/ownKey.d.ts +0 -1
- package/dist/ownKey.js +0 -2
- package/dist/permissionsDeclaration.d.ts +2 -2
- package/dist/permissionsDeclaration.js +12 -14
- package/dist/projectSeed.d.ts +39 -0
- package/dist/projectSeed.js +80 -0
- package/dist/promptDelivery.js +1 -1
- package/dist/replayBody.d.ts +7 -6
- package/dist/replayBody.js +62 -7
- package/dist/request/taskRequest.js +3 -4
- package/dist/ruleCompileVerdict.d.ts +0 -2
- package/dist/ruleCompileVerdict.js +0 -31
- package/dist/ruleRefusalSentence.js +0 -3
- package/dist/runReattachPolicy.d.ts +3 -0
- package/dist/runReattachPolicy.js +15 -2
- package/dist/runTerminal.js +30 -8
- package/dist/sandboxWire.d.ts +0 -3
- package/dist/sandboxWire.js +0 -9
- package/dist/sdkWireTransit.d.ts +1 -1
- package/dist/seam.d.ts +14 -7
- package/dist/seam.js +12 -0
- package/dist/seatContract.d.ts +58 -7
- package/dist/seatContract.js +135 -4
- package/dist/serverSupportRange.d.ts +18 -0
- package/dist/serverSupportRange.js +25 -0
- package/dist/sessionEngine.d.ts +156 -0
- package/dist/sessionEngine.js +464 -0
- package/dist/sessionMap.d.ts +11 -1
- package/dist/sessionMap.js +35 -9
- package/dist/sessionMemorySync.d.ts +31 -0
- package/dist/sessionMemorySync.js +95 -0
- package/dist/sessionRowTag.d.ts +4 -0
- package/dist/sessionRowTag.js +18 -0
- package/dist/settingsLayerAdmission.d.ts +1 -0
- package/dist/settingsLayerAdmission.js +4 -1
- package/dist/toolResult.js +1 -1
- package/dist/wireRefusalCopy.d.ts +6 -1
- package/dist/wireRefusalCopy.js +9 -7
- package/docs/INTEGRATION-CLIENTS.md +1393 -18
- package/package.json +5 -5
|
@@ -155,15 +155,48 @@ function isBusyStatus(status) {
|
|
|
155
155
|
function looksBusyError(apiError) {
|
|
156
156
|
return apiError !== undefined && /overload|rate.?limit|too many requests|too busy|server busy|capacity/i.test(apiError);
|
|
157
157
|
}
|
|
158
|
-
function
|
|
159
|
-
|
|
160
|
-
|
|
158
|
+
function wordOf(v) {
|
|
159
|
+
if (typeof v === 'string')
|
|
160
|
+
return v.trim() === '' ? undefined : v;
|
|
161
|
+
return typeof v === 'number' && Number.isFinite(v) && v !== 0 ? String(v) : undefined;
|
|
162
|
+
}
|
|
163
|
+
function hasContent(v, depth = 0) {
|
|
164
|
+
if (typeof v === 'string')
|
|
165
|
+
return v.trim() !== '';
|
|
166
|
+
if (typeof v === 'number')
|
|
167
|
+
return Number.isFinite(v) && v !== 0;
|
|
168
|
+
if (v === true)
|
|
169
|
+
return true;
|
|
170
|
+
if (v === null || typeof v !== 'object')
|
|
171
|
+
return false;
|
|
172
|
+
if (depth >= 2)
|
|
173
|
+
return true;
|
|
174
|
+
return (Array.isArray(v) ? v : Object.values(v)).some((x) => hasContent(x, depth + 1));
|
|
175
|
+
}
|
|
176
|
+
function errorBodyOf(parsed) {
|
|
177
|
+
if (parsed === null || typeof parsed !== 'object')
|
|
161
178
|
return undefined;
|
|
162
|
-
|
|
179
|
+
const e = parsed.error;
|
|
180
|
+
const o = e;
|
|
181
|
+
if (o !== null && o !== undefined && typeof o === 'object' && !Array.isArray(o)) {
|
|
182
|
+
const legacy = [o.code ?? o.type, o.message].filter(Boolean).join(': ');
|
|
183
|
+
if (legacy !== '')
|
|
184
|
+
return { words: legacy, standard: true };
|
|
185
|
+
}
|
|
186
|
+
if (!hasContent(e))
|
|
187
|
+
return undefined;
|
|
188
|
+
if (typeof e !== 'object' || e === null) {
|
|
189
|
+
const words = wordOf(e);
|
|
190
|
+
return words === undefined ? { standard: false } : { words, standard: false };
|
|
191
|
+
}
|
|
192
|
+
if (Array.isArray(e))
|
|
193
|
+
return { standard: false };
|
|
194
|
+
const words = [wordOf(o?.code) ?? wordOf(o?.type) ?? wordOf(o?.status), wordOf(o?.message) ?? wordOf(o?.detail)].filter((x) => x !== undefined).join(': ');
|
|
195
|
+
return { ...(words !== '' ? { words } : {}), standard: false };
|
|
163
196
|
}
|
|
164
|
-
function
|
|
197
|
+
function extractErrorBody(body) {
|
|
165
198
|
try {
|
|
166
|
-
return
|
|
199
|
+
return errorBodyOf(JSON.parse(body));
|
|
167
200
|
}
|
|
168
201
|
catch {
|
|
169
202
|
return undefined;
|
|
@@ -189,12 +222,10 @@ function shownApiError(raw, redact) {
|
|
|
189
222
|
const shown = displayUntrusted(masked, { max: 200 });
|
|
190
223
|
return shown.trim() === '' ? undefined : shown;
|
|
191
224
|
}
|
|
192
|
-
function
|
|
225
|
+
function namesModel(status, apiError) {
|
|
193
226
|
if (status !== 400 && status !== 404 && status !== 422)
|
|
194
227
|
return false;
|
|
195
|
-
|
|
196
|
-
return status === 404;
|
|
197
|
-
return /model/i.test(apiError);
|
|
228
|
+
return apiError !== undefined && /model/i.test(apiError);
|
|
198
229
|
}
|
|
199
230
|
const MESSAGES_PATH = '/v1/messages';
|
|
200
231
|
const COMPLETIONS_PATH = '/chat/completions';
|
|
@@ -204,33 +235,33 @@ function verdictRequestBody(modelId) {
|
|
|
204
235
|
return JSON.stringify({ model: modelId ?? '', max_tokens: 1, messages: [{ role: 'user', content: 'hi' }], stream: true });
|
|
205
236
|
}
|
|
206
237
|
function judgeMessagesFailure(status, body, hasModelId, near, redact) {
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
const
|
|
238
|
+
const eb = extractErrorBody(body);
|
|
239
|
+
const apiError = eb?.words;
|
|
240
|
+
const standard = eb?.standard === true;
|
|
210
241
|
const shown = shownApiError(apiError, redact);
|
|
211
242
|
const ev = { httpStatus: status, path: MESSAGES_PATH, ...(shown !== undefined ? { apiError: shown } : {}) };
|
|
243
|
+
if (status === 401 || status === 403)
|
|
244
|
+
return { verdict: 'auth', ...ev };
|
|
212
245
|
if (isBusyStatus(status) || looksBusyError(apiError))
|
|
213
246
|
return { verdict: 'busy', ...ev };
|
|
214
|
-
if (status
|
|
215
|
-
return { verdict: 'shape', httpStatus: status, path: MESSAGES_PATH };
|
|
216
|
-
if (looksLikeModelError(status, apiError)) {
|
|
217
|
-
if (!hasModelId)
|
|
218
|
-
return { verdict: 'ok', httpStatus: status, path: MESSAGES_PATH };
|
|
219
|
-
return { verdict: 'model', ...ev, ...(near !== undefined ? { nearModelId: near } : {}) };
|
|
220
|
-
}
|
|
221
|
-
if (!hasModelId && status >= 400 && status < 500 && apiError)
|
|
247
|
+
if (!hasModelId && standard && status >= 400 && status < 500)
|
|
222
248
|
return { verdict: 'ok', httpStatus: status, path: MESSAGES_PATH };
|
|
249
|
+
if (hasModelId && namesModel(status, apiError))
|
|
250
|
+
return { verdict: 'model', ...ev, ...(near !== undefined ? { nearModelId: near } : {}) };
|
|
251
|
+
if (status === 404 && !standard)
|
|
252
|
+
return { verdict: 'shape', ...ev };
|
|
223
253
|
return { verdict: 'other', ...ev };
|
|
224
254
|
}
|
|
225
255
|
function judgeCompletionsFailure(status, body, near, redact) {
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
const apiError = extractApiError(body);
|
|
256
|
+
const eb = extractErrorBody(body);
|
|
257
|
+
const apiError = eb?.words;
|
|
229
258
|
const shown = shownApiError(apiError, redact);
|
|
230
259
|
const ev = { httpStatus: status, path: COMPLETIONS_PATH, ...(shown !== undefined ? { apiError: shown } : {}) };
|
|
260
|
+
if (status === 401 || status === 403)
|
|
261
|
+
return { verdict: 'auth', ...ev };
|
|
231
262
|
if (isBusyStatus(status) || looksBusyError(apiError))
|
|
232
263
|
return { verdict: 'busy', ...ev };
|
|
233
|
-
if (
|
|
264
|
+
if (namesModel(status, apiError) || (status === 404 && eb?.standard !== true))
|
|
234
265
|
return { verdict: 'model', ...ev, ...(near !== undefined ? { nearModelId: near } : {}) };
|
|
235
266
|
return { verdict: 'other', ...ev };
|
|
236
267
|
}
|
|
@@ -318,9 +349,9 @@ function judgeJsonBody(text, contentType, api) {
|
|
|
318
349
|
if (obj === null || typeof obj !== 'object')
|
|
319
350
|
return { kind: 'not_model', contentType };
|
|
320
351
|
const o = obj;
|
|
321
|
-
const
|
|
322
|
-
if (
|
|
323
|
-
return { kind: 'error', ...(
|
|
352
|
+
const eb = errorBodyOf(o);
|
|
353
|
+
if (eb !== undefined || o.type === 'error')
|
|
354
|
+
return { kind: 'error', ...(eb?.words !== undefined ? { apiError: eb.words } : {}) };
|
|
324
355
|
const usage = (o.usage ?? null);
|
|
325
356
|
if (api === 'anthropic-messages') {
|
|
326
357
|
if (o.type !== 'message' && !Array.isArray(o.content))
|
|
@@ -365,9 +396,9 @@ function createAnswerScanner(contentType, api) {
|
|
|
365
396
|
if (obj === null || typeof obj !== 'object')
|
|
366
397
|
return;
|
|
367
398
|
const o = obj;
|
|
368
|
-
const
|
|
369
|
-
if (ev === 'error' || o.type === 'error' ||
|
|
370
|
-
settled = { kind: 'error', ...(
|
|
399
|
+
const eb = errorBodyOf(o);
|
|
400
|
+
if (ev === 'error' || o.type === 'error' || eb !== undefined) {
|
|
401
|
+
settled = { kind: 'error', ...(eb?.words !== undefined ? { apiError: eb.words } : {}) };
|
|
371
402
|
return;
|
|
372
403
|
}
|
|
373
404
|
if (isTokenFrame(o, api))
|
|
@@ -667,8 +698,10 @@ async function livenessOf(input) {
|
|
|
667
698
|
}
|
|
668
699
|
}
|
|
669
700
|
const gate = await getCatalogText(fetchIt, urlOf(MODELS_PATH_OPENAI), getHeaders, catalogBudget, input.signal);
|
|
670
|
-
if (gate.status === 401 || gate.status === 403)
|
|
671
|
-
|
|
701
|
+
if (gate.status === 401 || gate.status === 403) {
|
|
702
|
+
const shown = shownApiError(extractErrorBody(gate.text)?.words, redact);
|
|
703
|
+
return { verdict: 'auth', httpStatus: gate.status, path: '/models', ...(shown !== undefined ? { apiError: shown } : {}) };
|
|
704
|
+
}
|
|
672
705
|
if (isBusyStatus(gate.status))
|
|
673
706
|
return { verdict: 'busy', httpStatus: gate.status, path: '/models' };
|
|
674
707
|
if (gate.status < 200 || gate.status >= 300)
|
|
@@ -102,6 +102,8 @@ const OCCURRENCE_KEY_BY_CODE = Object.freeze({
|
|
|
102
102
|
'memory.hold_released': 'reportId',
|
|
103
103
|
'memory.hold_disposed': 'reportId',
|
|
104
104
|
'memory.consolidation_recommended': 'reportId',
|
|
105
|
+
'memory.harvest_refused': 'reportId',
|
|
106
|
+
'memory.harvest_conflict': 'reportId',
|
|
105
107
|
'memory.capture_opted_out': 'sessionId',
|
|
106
108
|
'memory.delegation_static_mark_waived': 'runId',
|
|
107
109
|
});
|
package/dist/ownKey.d.ts
CHANGED
package/dist/ownKey.js
CHANGED
|
@@ -221,7 +221,6 @@ export function promptManifestSectionViewOf(row) {
|
|
|
221
221
|
const locale = str(o.locale);
|
|
222
222
|
const variant = str(o.variant);
|
|
223
223
|
const contentHash = band !== undefined ? str(o.contentHash) : undefined;
|
|
224
|
-
const slot = str(o.slot);
|
|
225
224
|
return {
|
|
226
225
|
id,
|
|
227
226
|
chars,
|
|
@@ -229,7 +228,6 @@ export function promptManifestSectionViewOf(row) {
|
|
|
229
228
|
...(locale !== undefined ? { locale } : {}),
|
|
230
229
|
...(variant !== undefined ? { variant } : {}),
|
|
231
230
|
...(contentHash !== undefined ? { contentHash } : {}),
|
|
232
|
-
...(slot !== undefined ? { slot } : {}),
|
|
233
231
|
};
|
|
234
232
|
}
|
|
235
233
|
export function promptManifestIdentityOfFrame(frame) {
|
|
@@ -6,6 +6,7 @@ declare const SETTINGS_SOURCE_TIERS: Readonly<{
|
|
|
6
6
|
readonly userSettings: "global";
|
|
7
7
|
readonly localSettings: "project";
|
|
8
8
|
readonly projectSettings: "project";
|
|
9
|
+
readonly foreignProjectSettings: "project";
|
|
9
10
|
}>;
|
|
10
11
|
declare const OFF_LADDER_ROWS: readonly [{
|
|
11
12
|
readonly origin: "cliArg";
|
|
@@ -29,7 +30,6 @@ export interface PermissionsDeclarationInput {
|
|
|
29
30
|
readonly cliDeny?: readonly string[];
|
|
30
31
|
readonly settingsRead: 'clean' | 'partial' | 'unreadable';
|
|
31
32
|
readonly clientOwnedServers?: readonly string[];
|
|
32
|
-
readonly serverVersion?: string;
|
|
33
33
|
}
|
|
34
34
|
export interface PermissionsDeclarationBuckets {
|
|
35
35
|
deny?: string[];
|
|
@@ -57,7 +57,7 @@ export interface HostPermissionsBuckets {
|
|
|
57
57
|
export interface HostPermissionsDeclaration {
|
|
58
58
|
permissions?: HostPermissionsBuckets;
|
|
59
59
|
}
|
|
60
|
-
export declare const PERMISSIONS_KEPT_REASONS: readonly ["allow_capability_off", "settings_read_not_clean", "empty_rule", "paren_in_tool_name", "retired_tool_name", "unprefixed_namespaced_name", "incomplete_protocol_name", "unminted_protocol_segment", "home_relative_path", "compile_refused", "content_form_not_grantable", "
|
|
60
|
+
export declare const PERMISSIONS_KEPT_REASONS: readonly ["allow_capability_off", "settings_read_not_clean", "empty_rule", "paren_in_tool_name", "retired_tool_name", "unprefixed_namespaced_name", "incomplete_protocol_name", "unminted_protocol_segment", "home_relative_path", "compile_refused", "content_form_not_grantable", "judge_failed", "duplicate", "voids_allow_list"];
|
|
61
61
|
export type PermissionsKeptReason = (typeof PERMISSIONS_KEPT_REASONS)[number];
|
|
62
62
|
export interface PermissionsKeptRule {
|
|
63
63
|
rule: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { compileAllowList, hasCoreValuePort, protocolOf, ruleToolGrammarOf } from './coreValuePorts.js';
|
|
2
2
|
import { clientOwnedServerPrefix, ruleToolNameVerdictOf } from './protocolSegment.js';
|
|
3
|
-
import { ruleCompileVerdict
|
|
3
|
+
import { ruleCompileVerdict } from './ruleCompileVerdict.js';
|
|
4
4
|
import { allowRulesGate, allowWireForm } from './permissionsAllowGrantCapability.js';
|
|
5
5
|
import { SETTINGS_IS_AT_LEAST } from './generated/settingsSchemaFns.js';
|
|
6
6
|
import { THROWN_SLOT_UNREADABLE, asAssemblyRefusal, assemblyRefusalOf, isSlotCarrier, readThrownSlot, withAssemblyRefusal } from './wireFailureShape.js';
|
|
@@ -11,8 +11,9 @@ const SETTINGS_SOURCE_TIERS = Object.freeze({
|
|
|
11
11
|
userSettings: 'global',
|
|
12
12
|
localSettings: 'project',
|
|
13
13
|
projectSettings: 'project',
|
|
14
|
+
foreignProjectSettings: 'project',
|
|
14
15
|
});
|
|
15
|
-
const SAME_TIER_ORDER = ['flagSettings', 'userSettings', 'localSettings', 'projectSettings'];
|
|
16
|
+
const SAME_TIER_ORDER = ['flagSettings', 'userSettings', 'localSettings', 'projectSettings', 'foreignProjectSettings'];
|
|
16
17
|
const OFF_LADDER_ROWS = Object.freeze([
|
|
17
18
|
{ origin: 'cliArg', after: 'policySettings' },
|
|
18
19
|
{ origin: 'session', after: 'flagSettings' },
|
|
@@ -47,7 +48,6 @@ export const PERMISSIONS_KEPT_REASONS = Object.freeze([
|
|
|
47
48
|
'home_relative_path',
|
|
48
49
|
'compile_refused',
|
|
49
50
|
'content_form_not_grantable',
|
|
50
|
-
'content_form_never_matches',
|
|
51
51
|
'judge_failed',
|
|
52
52
|
'duplicate',
|
|
53
53
|
'voids_allow_list',
|
|
@@ -154,7 +154,7 @@ function tighteningWholeName(name, check) {
|
|
|
154
154
|
const next = nameCheck(successor);
|
|
155
155
|
return 'retired' in next || 'issue' in next ? name : successor;
|
|
156
156
|
}
|
|
157
|
-
function judgeList(rules, behavior, allowForm = 'grant'
|
|
157
|
+
function judgeList(rules, behavior, allowForm = 'grant') {
|
|
158
158
|
let portsChecked = false;
|
|
159
159
|
return rules.map((rule) => {
|
|
160
160
|
if (rule === '')
|
|
@@ -184,7 +184,7 @@ function judgeList(rules, behavior, allowForm = 'grant', serverVersion) {
|
|
|
184
184
|
}
|
|
185
185
|
const check = nameCheck(parsed.toolName);
|
|
186
186
|
if (behavior !== 'allow')
|
|
187
|
-
return
|
|
187
|
+
return { sent: true, wire: rule };
|
|
188
188
|
if ('retired' in check)
|
|
189
189
|
return kept('retired_tool_name');
|
|
190
190
|
if ('issue' in check)
|
|
@@ -244,7 +244,7 @@ function allowListVoiders(sent) {
|
|
|
244
244
|
return 'unknown';
|
|
245
245
|
}
|
|
246
246
|
}
|
|
247
|
-
function judgeBucket(raw, behavior, originOf, cli, settingsGate, allowForm = 'grant', dropWire, owned = [],
|
|
247
|
+
function judgeBucket(raw, behavior, originOf, cli, settingsGate, allowForm = 'grant', dropWire, owned = [], layeredFrom) {
|
|
248
248
|
const firstSlot = new Map();
|
|
249
249
|
for (const s of raw)
|
|
250
250
|
if (!firstSlot.has(s.rule))
|
|
@@ -288,7 +288,7 @@ function judgeBucket(raw, behavior, originOf, cli, settingsGate, allowForm = 'gr
|
|
|
288
288
|
};
|
|
289
289
|
const appendGroup = (group, origin) => {
|
|
290
290
|
const held = settingsGate !== undefined && !outsideSettingsFiles(origin);
|
|
291
|
-
const fates = held ? group.map(() => kept(settingsGate)) : judgeList(group, behavior, allowForm
|
|
291
|
+
const fates = held ? group.map(() => kept(settingsGate)) : judgeList(group, behavior, allowForm);
|
|
292
292
|
group.forEach((r, k) => {
|
|
293
293
|
const f = place(firstSlot.get(r), fates[k], origin);
|
|
294
294
|
if (!fateOfRule.has(r))
|
|
@@ -412,19 +412,17 @@ function readAssemblyInput(input, caps) {
|
|
|
412
412
|
origins = { ...(od ? { deny: od } : {}), ...(oa ? { ask: oa } : {}), ...(ol ? { allow: ol } : {}) };
|
|
413
413
|
}
|
|
414
414
|
const gate = allowRulesGate(caps, ownField(input, 'settingsRead', ''));
|
|
415
|
-
|
|
416
|
-
const serverVersion = typeof versionRaw === 'string' ? versionRaw : undefined;
|
|
417
|
-
return { deny, ask, allow, cliDeny, ownedServers, origins, gate, serverVersion };
|
|
415
|
+
return { deny, ask, allow, cliDeny, ownedServers, origins, gate };
|
|
418
416
|
}
|
|
419
417
|
function judgeAssembly(read, caps, layered) {
|
|
420
|
-
const { deny, ask, allow, cliDeny, ownedServers, origins, gate
|
|
418
|
+
const { deny, ask, allow, cliDeny, ownedServers, origins, gate } = read;
|
|
421
419
|
const cliSlots = slotsOf(cliDeny, 'cliDeny');
|
|
422
|
-
const cli = cliDeny === undefined ? undefined : { slots: cliSlots, fates: judgeList(cliDeny, 'deny', 'grant'
|
|
420
|
+
const cli = cliDeny === undefined ? undefined : { slots: cliSlots, fates: judgeList(cliDeny, 'deny', 'grant') };
|
|
423
421
|
const denySlots = slotsOf(deny, 'deny');
|
|
424
422
|
const askSlots = slotsOf(ask, 'ask');
|
|
425
423
|
const allowSlots = slotsOf(allow, 'allow');
|
|
426
|
-
const denyJ = judgeBucket(denySlots, 'deny', origins.deny, cli, undefined, 'grant', undefined, [],
|
|
427
|
-
const askJ = judgeBucket(askSlots, 'ask', origins.ask, undefined, undefined, 'grant', undefined, [],
|
|
424
|
+
const denyJ = judgeBucket(denySlots, 'deny', origins.deny, cli, undefined, 'grant', undefined, [], layered?.deny);
|
|
425
|
+
const askJ = judgeBucket(askSlots, 'ask', origins.ask, undefined, undefined, 'grant', undefined, [], layered?.ask);
|
|
428
426
|
const allowForm = allowWireForm(caps) === 'layer' ? 'layer' : 'grant';
|
|
429
427
|
const settingsGate = gate === 'settings_read_not_clean' ? 'settings_read_not_clean' : undefined;
|
|
430
428
|
let allowJ = gate === 'capability_off'
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { ATTACHMENT_BOUND_ELSEWHERE, ATTACHMENT_BUNDLE_INVALID, ATTACHMENT_BUNDLE_LANE_NOT_ISOLATED, ATTACHMENT_BUNDLE_SEED_FIXED } from './engineErrorCodes.js';
|
|
2
|
+
import type { UiLanguage } from './env/uiLanguage.js';
|
|
3
|
+
export type ProjectSeedArm = 'handoff' | 'mirror' | 'sidecar';
|
|
4
|
+
export type ProjectSeedGate = {
|
|
5
|
+
readonly kind: 'ready';
|
|
6
|
+
readonly attachmentIds: readonly [string];
|
|
7
|
+
} | {
|
|
8
|
+
readonly kind: 'not_carried';
|
|
9
|
+
} | {
|
|
10
|
+
readonly kind: 'lane_not_isolated';
|
|
11
|
+
} | {
|
|
12
|
+
readonly kind: 'lane_unknown';
|
|
13
|
+
} | {
|
|
14
|
+
readonly kind: 'seed_missing';
|
|
15
|
+
};
|
|
16
|
+
export interface ProjectSeedGateInput {
|
|
17
|
+
readonly arm: ProjectSeedArm;
|
|
18
|
+
readonly caps: {} | null | undefined;
|
|
19
|
+
readonly attachmentId?: string | null;
|
|
20
|
+
}
|
|
21
|
+
export declare function projectSeedGateOf(input: ProjectSeedGateInput): ProjectSeedGate;
|
|
22
|
+
export type ProjectSeedRefusal = {
|
|
23
|
+
readonly code: typeof ATTACHMENT_BUNDLE_INVALID;
|
|
24
|
+
readonly reason?: string;
|
|
25
|
+
readonly path?: string;
|
|
26
|
+
} | {
|
|
27
|
+
readonly code: typeof ATTACHMENT_BUNDLE_LANE_NOT_ISOLATED;
|
|
28
|
+
readonly id?: string;
|
|
29
|
+
readonly lane?: string;
|
|
30
|
+
} | {
|
|
31
|
+
readonly code: typeof ATTACHMENT_BUNDLE_SEED_FIXED;
|
|
32
|
+
readonly id?: string;
|
|
33
|
+
} | {
|
|
34
|
+
readonly code: typeof ATTACHMENT_BOUND_ELSEWHERE;
|
|
35
|
+
readonly id?: string;
|
|
36
|
+
};
|
|
37
|
+
export declare function projectSeedRefusalOf(err: {} | null | undefined): ProjectSeedRefusal | null;
|
|
38
|
+
export declare function projectSeedRefusalContent(refusal: ProjectSeedRefusal, lang?: UiLanguage): string;
|
|
39
|
+
export declare function projectSeedGateContent(gate: ProjectSeedGate, lang?: UiLanguage): string | undefined;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { ATTACHMENT_BOUND_ELSEWHERE, ATTACHMENT_BUNDLE_INVALID, ATTACHMENT_BUNDLE_LANE_NOT_ISOLATED, ATTACHMENT_BUNDLE_SEED_FIXED } from './engineErrorCodes.js';
|
|
2
|
+
import { projectExecutionLaneCapability } from './executionLaneCapability.js';
|
|
3
|
+
import { capForDisplay } from './fleetTaskDesc.js';
|
|
4
|
+
import { ownDataField } from './ownKey.js';
|
|
5
|
+
import { isSlotCarrier, readErrorString } from './wireFailureShape.js';
|
|
6
|
+
import { effectiveWireErrorCode } from './wireErrorTriage.js';
|
|
7
|
+
import { msg, renderMessage } from './i18n/translate.js';
|
|
8
|
+
export function projectSeedGateOf(input) {
|
|
9
|
+
try {
|
|
10
|
+
if (ownDataField(input, 'arm') !== 'handoff')
|
|
11
|
+
return Object.freeze({ kind: 'not_carried' });
|
|
12
|
+
const reading = projectExecutionLaneCapability(ownDataField(input, 'caps'));
|
|
13
|
+
const isolated = reading?.kind === 'present' ? reading.view.isolated : undefined;
|
|
14
|
+
if (isolated === false)
|
|
15
|
+
return Object.freeze({ kind: 'lane_not_isolated' });
|
|
16
|
+
if (isolated !== true)
|
|
17
|
+
return Object.freeze({ kind: 'lane_unknown' });
|
|
18
|
+
const id = ownDataField(input, 'attachmentId');
|
|
19
|
+
if (typeof id !== 'string' || id.length === 0)
|
|
20
|
+
return Object.freeze({ kind: 'seed_missing' });
|
|
21
|
+
return Object.freeze({ kind: 'ready', attachmentIds: Object.freeze([id]) });
|
|
22
|
+
}
|
|
23
|
+
catch {
|
|
24
|
+
return Object.freeze({ kind: 'not_carried' });
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
const nonEmpty = (v) => (typeof v === 'string' && v.length > 0 ? v : undefined);
|
|
28
|
+
export function projectSeedRefusalOf(err) {
|
|
29
|
+
try {
|
|
30
|
+
if (!isSlotCarrier(err))
|
|
31
|
+
return null;
|
|
32
|
+
const code = effectiveWireErrorCode(err);
|
|
33
|
+
const o = err;
|
|
34
|
+
if (code === ATTACHMENT_BUNDLE_INVALID) {
|
|
35
|
+
const reason = nonEmpty(readErrorString(o, 'reason'));
|
|
36
|
+
const path = nonEmpty(readErrorString(o, 'path'));
|
|
37
|
+
return Object.freeze({ code, ...(reason !== undefined ? { reason } : {}), ...(path !== undefined ? { path } : {}) });
|
|
38
|
+
}
|
|
39
|
+
if (code === ATTACHMENT_BUNDLE_LANE_NOT_ISOLATED) {
|
|
40
|
+
const id = nonEmpty(readErrorString(o, 'id'));
|
|
41
|
+
const lane = nonEmpty(readErrorString(o, 'lane'));
|
|
42
|
+
return Object.freeze({ code, ...(id !== undefined ? { id } : {}), ...(lane !== undefined ? { lane } : {}) });
|
|
43
|
+
}
|
|
44
|
+
if (code === ATTACHMENT_BUNDLE_SEED_FIXED || code === ATTACHMENT_BOUND_ELSEWHERE) {
|
|
45
|
+
const id = nonEmpty(readErrorString(o, 'id'));
|
|
46
|
+
return Object.freeze({ code, ...(id !== undefined ? { id } : {}) });
|
|
47
|
+
}
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
catch {
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
const SEED_PATH_DISPLAY_MAX = 200;
|
|
55
|
+
export function projectSeedRefusalContent(refusal, lang) {
|
|
56
|
+
switch (refusal.code) {
|
|
57
|
+
case ATTACHMENT_BUNDLE_INVALID: {
|
|
58
|
+
const sentence = renderMessage(msg('session.projectSeed.invalid'), lang);
|
|
59
|
+
return refusal.path === undefined ? sentence : renderMessage(msg('session.projectSeed.invalidAt', { sentence, path: capForDisplay(refusal.path, SEED_PATH_DISPLAY_MAX) }), lang);
|
|
60
|
+
}
|
|
61
|
+
case ATTACHMENT_BUNDLE_LANE_NOT_ISOLATED:
|
|
62
|
+
return renderMessage(msg('session.projectSeed.laneNotIsolated'), lang);
|
|
63
|
+
case ATTACHMENT_BUNDLE_SEED_FIXED:
|
|
64
|
+
return renderMessage(msg('session.projectSeed.seedFixed'), lang);
|
|
65
|
+
case ATTACHMENT_BOUND_ELSEWHERE:
|
|
66
|
+
return renderMessage(msg('session.projectSeed.boundElsewhere'), lang);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
export function projectSeedGateContent(gate, lang) {
|
|
70
|
+
switch (gate.kind) {
|
|
71
|
+
case 'lane_not_isolated':
|
|
72
|
+
return renderMessage(msg('session.projectSeed.laneNotIsolated'), lang);
|
|
73
|
+
case 'lane_unknown':
|
|
74
|
+
return renderMessage(msg('session.projectSeed.laneUnknown'), lang);
|
|
75
|
+
case 'seed_missing':
|
|
76
|
+
return renderMessage(msg('session.projectSeed.missing'), lang);
|
|
77
|
+
default:
|
|
78
|
+
return undefined;
|
|
79
|
+
}
|
|
80
|
+
}
|
package/dist/promptDelivery.js
CHANGED
|
@@ -149,7 +149,7 @@ function batchTiers(batch) {
|
|
|
149
149
|
const inFull = new Set(full);
|
|
150
150
|
return { full, partial: partial.filter((u) => !inFull.has(u)) };
|
|
151
151
|
}
|
|
152
|
-
const PRE_RUN_FRAME_TYPES = new Set(['meta', 'approval_request', 'approval_revoke']);
|
|
152
|
+
const PRE_RUN_FRAME_TYPES = new Set(['meta', 'approval_request', 'approval_revoke', 'approval_complete']);
|
|
153
153
|
export function frameProvesDelivery(event) {
|
|
154
154
|
if (typeof event !== 'object' || event === null)
|
|
155
155
|
return false;
|
package/dist/replayBody.d.ts
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
export interface
|
|
2
|
-
readonly
|
|
3
|
-
readonly errorCode?: string;
|
|
4
|
-
readonly error?: string;
|
|
1
|
+
export interface RunReceiptView {
|
|
2
|
+
readonly taskId?: string;
|
|
5
3
|
readonly sessionId?: string;
|
|
4
|
+
readonly status?: string;
|
|
6
5
|
}
|
|
7
6
|
export interface DoneResultView {
|
|
8
7
|
readonly replay: boolean;
|
|
9
|
-
readonly
|
|
10
|
-
readonly
|
|
8
|
+
readonly receipt: boolean;
|
|
9
|
+
readonly body: unknown;
|
|
11
10
|
}
|
|
11
|
+
export declare function terminalLayerOf<T>(carrier: T): T | object;
|
|
12
|
+
export declare function runRowSentenceOf<T>(carrier: T): string | undefined;
|
|
12
13
|
export declare function doneResultView(result: unknown): DoneResultView;
|
|
13
14
|
export declare function isReplayedTerminal(frame: object | null | undefined): boolean;
|
|
14
15
|
export declare function isReplayMarked(message: object | null | undefined): boolean;
|
package/dist/replayBody.js
CHANGED
|
@@ -11,18 +11,73 @@ function guardedString(o, k) {
|
|
|
11
11
|
const v = guarded(o, k);
|
|
12
12
|
return typeof v === 'string' && v.length > 0 ? v : undefined;
|
|
13
13
|
}
|
|
14
|
+
function guardedIn(o, k) {
|
|
15
|
+
try {
|
|
16
|
+
return k in o;
|
|
17
|
+
}
|
|
18
|
+
catch {
|
|
19
|
+
return undefined;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
function carriesEngineResult(o) {
|
|
23
|
+
const stats = guardedIn(o, 'stats');
|
|
24
|
+
const terminal = guardedIn(o, 'terminal');
|
|
25
|
+
if (stats === true || terminal === true)
|
|
26
|
+
return true;
|
|
27
|
+
return stats === false && terminal === false ? false : undefined;
|
|
28
|
+
}
|
|
29
|
+
function engineResultLayerOf(carrier) {
|
|
30
|
+
try {
|
|
31
|
+
if (typeof carrier !== 'object' || carrier === null || Array.isArray(carrier))
|
|
32
|
+
return undefined;
|
|
33
|
+
const own = carriesEngineResult(carrier);
|
|
34
|
+
if (own !== false)
|
|
35
|
+
return own === true ? carrier : undefined;
|
|
36
|
+
const nested = guarded(carrier, 'result');
|
|
37
|
+
if (typeof nested !== 'object' || nested === null || Array.isArray(nested))
|
|
38
|
+
return undefined;
|
|
39
|
+
return carriesEngineResult(nested) === true ? nested : undefined;
|
|
40
|
+
}
|
|
41
|
+
catch {
|
|
42
|
+
return undefined;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
function isRunReceiptShape(o) {
|
|
46
|
+
return guardedIn(o, 'activeTaskId') === false && guardedIn(o, 'taskId') === true;
|
|
47
|
+
}
|
|
48
|
+
export function terminalLayerOf(carrier) {
|
|
49
|
+
return engineResultLayerOf(carrier) ?? carrier;
|
|
50
|
+
}
|
|
51
|
+
export function runRowSentenceOf(carrier) {
|
|
52
|
+
try {
|
|
53
|
+
if (typeof carrier !== 'object' || carrier === null || Array.isArray(carrier))
|
|
54
|
+
return undefined;
|
|
55
|
+
if (engineResultLayerOf(carrier) !== undefined)
|
|
56
|
+
return undefined;
|
|
57
|
+
if (!isRunReceiptShape(carrier))
|
|
58
|
+
return undefined;
|
|
59
|
+
return guardedString(carrier, 'error');
|
|
60
|
+
}
|
|
61
|
+
catch {
|
|
62
|
+
return undefined;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
14
65
|
export function doneResultView(result) {
|
|
15
66
|
if (typeof result !== 'object' || result === null || Array.isArray(result))
|
|
16
|
-
return { replay: false,
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
67
|
+
return { replay: false, receipt: false, body: result };
|
|
68
|
+
const replay = guarded(result, 'replay') === true;
|
|
69
|
+
const engine = engineResultLayerOf(result);
|
|
70
|
+
if (engine !== undefined)
|
|
71
|
+
return { replay, receipt: false, body: engine };
|
|
72
|
+
if (!isRunReceiptShape(result))
|
|
73
|
+
return { replay, receipt: false, body: result };
|
|
74
|
+
const view = {};
|
|
75
|
+
for (const k of ['taskId', 'sessionId', 'status']) {
|
|
21
76
|
const v = guardedString(result, k);
|
|
22
77
|
if (v !== undefined)
|
|
23
|
-
|
|
78
|
+
view[k] = v;
|
|
24
79
|
}
|
|
25
|
-
return { replay: true,
|
|
80
|
+
return { replay, receipt: true, body: Object.freeze(view) };
|
|
26
81
|
}
|
|
27
82
|
export function isReplayedTerminal(frame) {
|
|
28
83
|
if (frame === null || typeof frame !== 'object' || Array.isArray(frame))
|
|
@@ -450,7 +450,7 @@ const resolvedSnapshotForWire = (resolved) => {
|
|
|
450
450
|
export function hostTurnSettings(input) {
|
|
451
451
|
return buildHostTurnSettings(input, { materialize: (snapshot) => resolvedSnapshotForWire(snapshot), memoryOffDeclared });
|
|
452
452
|
}
|
|
453
|
-
const fileRestoreRequested = (restoreFiles, rewindFilesTo
|
|
453
|
+
const fileRestoreRequested = (restoreFiles, rewindFilesTo) => restoreFiles === true || (typeof rewindFilesTo === 'string' && rewindFilesTo.length > 0);
|
|
454
454
|
function tightenedRequestOf(request, intake, lane) {
|
|
455
455
|
const readData = (key) => {
|
|
456
456
|
try {
|
|
@@ -489,10 +489,9 @@ function tightenedRequestOf(request, intake, lane) {
|
|
|
489
489
|
if (sent.value !== FILE_HISTORY_DISABLED) {
|
|
490
490
|
const restoreFiles = readData('restoreFiles');
|
|
491
491
|
const rewindFilesTo = readData('rewindFilesTo');
|
|
492
|
-
|
|
493
|
-
if (!restoreFiles.ok || !rewindFilesTo.ok || !rewindFiles.ok)
|
|
492
|
+
if (!restoreFiles.ok || !rewindFilesTo.ok)
|
|
494
493
|
return unjudged;
|
|
495
|
-
if (fileRestoreRequested(restoreFiles.value, rewindFilesTo.value
|
|
494
|
+
if (fileRestoreRequested(restoreFiles.value, rewindFilesTo.value))
|
|
496
495
|
return { kind: 'refuse', notice: hostFileHistoryRestoreNotice() };
|
|
497
496
|
add.fileHistory = FILE_HISTORY_DISABLED;
|
|
498
497
|
appendOwnElement(tightened, 'fileHistory');
|
|
@@ -25,5 +25,3 @@ export type DenyEntryReading = {
|
|
|
25
25
|
readonly kind: 'unknown';
|
|
26
26
|
};
|
|
27
27
|
export declare function denyEntryReading(rule: string): DenyEntryReading;
|
|
28
|
-
export declare const DOMAIN_TIGHTEN_HONORED_FROM = "7.135.0";
|
|
29
|
-
export declare function tightenEntryNeverMatches(rule: string, serverVersion: string | undefined): boolean;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { readRuleEntry, validatePermissionRules } from './coreValuePorts.js';
|
|
2
2
|
import { guardedRead, readOwnDataValue } from './ownKey.js';
|
|
3
|
-
import { engineVersionTier } from './supportFloor.js';
|
|
4
3
|
const RULE_COMPILE_ROOT = '/';
|
|
5
4
|
function issueText(issue, key) {
|
|
6
5
|
try {
|
|
@@ -73,33 +72,3 @@ export function denyEntryReading(rule) {
|
|
|
73
72
|
return { kind: 'unknown' };
|
|
74
73
|
}
|
|
75
74
|
}
|
|
76
|
-
function readsAsDomainSpelling(rule) {
|
|
77
|
-
try {
|
|
78
|
-
const reading = readRuleEntry(rule, 'allow');
|
|
79
|
-
if (typeof reading !== 'object' || reading === null)
|
|
80
|
-
return false;
|
|
81
|
-
if (readOwnDataValue(reading, 'kind') !== 'row')
|
|
82
|
-
return false;
|
|
83
|
-
const compiled = readOwnDataValue(reading, 'compiled');
|
|
84
|
-
if (typeof compiled !== 'object' || compiled === null)
|
|
85
|
-
return false;
|
|
86
|
-
return readOwnDataValue(compiled, 'kind') === 'domain';
|
|
87
|
-
}
|
|
88
|
-
catch {
|
|
89
|
-
return false;
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
export const DOMAIN_TIGHTEN_HONORED_FROM = '7.135.0';
|
|
93
|
-
function targetLeavesDomainTightenInert(serverVersion) {
|
|
94
|
-
return engineVersionTier(serverVersion) === 'engine' && engineVersionTier(serverVersion, DOMAIN_TIGHTEN_HONORED_FROM) === 'legacy';
|
|
95
|
-
}
|
|
96
|
-
export function tightenEntryNeverMatches(rule, serverVersion) {
|
|
97
|
-
if (!targetLeavesDomainTightenInert(serverVersion))
|
|
98
|
-
return false;
|
|
99
|
-
const r = denyEntryReading(rule);
|
|
100
|
-
if (r.kind !== 'inert' || r.reason !== 'content_unsupported')
|
|
101
|
-
return false;
|
|
102
|
-
if (!readsAsDomainSpelling(rule))
|
|
103
|
-
return false;
|
|
104
|
-
return ruleCompileVerdict(rule, 'deny').kind === 'compiles';
|
|
105
|
-
}
|
|
@@ -10,7 +10,6 @@ const CLASS_OF_REASON = Object.freeze({
|
|
|
10
10
|
home_relative_path: 'homePath',
|
|
11
11
|
compile_refused: 'compile',
|
|
12
12
|
paren_in_tool_name: 'compile',
|
|
13
|
-
content_form_never_matches: 'neverMatches',
|
|
14
13
|
});
|
|
15
14
|
function reasonOf(row, lang) {
|
|
16
15
|
const cls = typeof row.reason === 'string' && Object.hasOwn(CLASS_OF_REASON, row.reason) ? CLASS_OF_REASON[row.reason] : undefined;
|
|
@@ -18,8 +17,6 @@ function reasonOf(row, lang) {
|
|
|
18
17
|
return renderMessage(msg('rules.refusal.reason.toolName'), lang);
|
|
19
18
|
if (cls === 'homePath')
|
|
20
19
|
return renderMessage(msg('rules.refusal.reason.homePath'), lang);
|
|
21
|
-
if (cls === 'neverMatches')
|
|
22
|
-
return renderMessage(msg('rules.refusal.reason.neverMatches'), lang);
|
|
23
20
|
if (cls === 'compile')
|
|
24
21
|
return permissionRuleIssueDetail(row.code, row.message, row.rule, lang);
|
|
25
22
|
return undefined;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type RunNotFollowed } from './runFollow.js';
|
|
2
2
|
export declare const REATTACH_MAX_TRIES = 5;
|
|
3
|
+
export declare const STREAM_CAP_CREDIBLE_AFTER_MS = 300000;
|
|
3
4
|
export interface ReattachBudget {
|
|
4
5
|
readonly tries: number;
|
|
5
6
|
readonly drainingStreak: number;
|
|
@@ -14,6 +15,7 @@ export type ReattachEvent = {
|
|
|
14
15
|
} | {
|
|
15
16
|
readonly cause: 'stream_cap';
|
|
16
17
|
readonly runId?: string;
|
|
18
|
+
readonly legElapsedMs?: number;
|
|
17
19
|
} | {
|
|
18
20
|
readonly cause: 'stream_draining';
|
|
19
21
|
readonly runId?: string;
|
|
@@ -30,6 +32,7 @@ export type ReattachDrainingEvent = Extract<ReattachEvent, {
|
|
|
30
32
|
export type ReattachDecision = {
|
|
31
33
|
readonly action: 'reattach';
|
|
32
34
|
readonly afterMs: number;
|
|
35
|
+
readonly premature?: true;
|
|
33
36
|
readonly budget: ReattachBudget;
|
|
34
37
|
} | {
|
|
35
38
|
readonly action: 'give_up';
|