omnius 1.0.954 → 1.0.956
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/dist/_types/execution/native-file-write-observation.d.ts +19 -0
- package/dist/_types/execution/native-memory-view-provider.d.ts +84 -0
- package/dist/_types/execution/shell-runs.d.ts +4 -0
- package/dist/_types/execution/tool-output-spool.d.ts +61 -0
- package/dist/_types/execution/tools/file-write.d.ts +53 -0
- package/dist/_types/execution/types.d.ts +34 -0
- package/dist/_types/execution/work-mode-capability.d.ts +23 -0
- package/dist/_types/memory/candidateCoverage.d.ts +23 -0
- package/dist/_types/memory/embeddings.d.ts +1 -1
- package/dist/_types/memory/memoryCapability.d.ts +259 -0
- package/dist/_types/memory/memorySourceResolver.d.ts +133 -0
- package/dist/_types/memory/memoryTypes.d.ts +16 -0
- package/dist/_types/memory/structuredMemoryStore.d.ts +63 -6
- package/dist/_types/memory/unifiedMemoryStore.d.ts +12 -1
- package/dist/_types/orchestrator/agenticRunner.d.ts +241 -46
- package/dist/_types/orchestrator/authored-instruction-context.d.ts +59 -0
- package/dist/_types/orchestrator/authored-instruction-revisions.d.ts +56 -0
- package/dist/_types/orchestrator/authored-instruction-sources.d.ts +60 -0
- package/dist/_types/orchestrator/auxiliary-context-operation.d.ts +196 -0
- package/dist/_types/orchestrator/brokered-tool-composition.d.ts +141 -0
- package/dist/_types/orchestrator/completionReadiness.d.ts +2 -2
- package/dist/_types/orchestrator/confined-composition-worker.d.ts +45 -0
- package/dist/_types/orchestrator/contentAddressedArtifactStore.d.ts +173 -0
- package/dist/_types/orchestrator/contextWindowDump.d.ts +4 -0
- package/dist/_types/orchestrator/explicit-work-mode.d.ts +92 -0
- package/dist/_types/orchestrator/interruption-lifecycle.d.ts +3 -0
- package/dist/_types/orchestrator/memory-capability-context.d.ts +49 -0
- package/dist/_types/orchestrator/owned-inference-wait.d.ts +123 -0
- package/dist/_types/orchestrator/owned-model-wait.d.ts +26 -0
- package/dist/_types/orchestrator/provider-context-contract.d.ts +78 -0
- package/dist/_types/orchestrator/request-tool-capabilities.d.ts +52 -0
- package/dist/_types/orchestrator/structured-memory-extraction-worker.d.ts +20 -0
- package/dist/_types/orchestrator/structuredMemoryInference.d.ts +12 -0
- package/dist/_types/orchestrator/successful-procedure-memory.d.ts +35 -0
- package/dist/api/py-embed.js +70 -17
- package/dist/index.js +2 -2
- package/dist/library.js +115248 -107892
- package/dist/memory-maintenance-worker.js +486 -81
- package/dist/omni-setup-worker.js +83 -30
- package/dist/tui/native/worker.js +3 -1
- package/dist/update-worker-runtime.js +280 -126
- package/docs/DISCOVERY.json +63 -0
- package/docs/DISCOVERY.md +1 -0
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
|
@@ -4700,7 +4700,7 @@ function registerProcessLease(args, options) {
|
|
|
4700
4700
|
...inspected,
|
|
4701
4701
|
commandHash: inspected.commandHash || (inspected.command ? hashProcessCommand(inspected.command) : void 0)
|
|
4702
4702
|
} : void 0;
|
|
4703
|
-
const
|
|
4703
|
+
const record2 = {
|
|
4704
4704
|
leaseId,
|
|
4705
4705
|
pid: args.pid,
|
|
4706
4706
|
pgid: args.pgid ?? identity?.pgid,
|
|
@@ -4723,11 +4723,11 @@ function registerProcessLease(args, options) {
|
|
|
4723
4723
|
};
|
|
4724
4724
|
const store = readActiveStore(options);
|
|
4725
4725
|
const withoutCurrent = store.leases.filter((lease) => lease.leaseId !== leaseId);
|
|
4726
|
-
withoutCurrent.push(
|
|
4726
|
+
withoutCurrent.push(record2);
|
|
4727
4727
|
const next = { version: 1, updatedAt: now, leases: withoutCurrent };
|
|
4728
4728
|
writeActiveStore(next, options);
|
|
4729
|
-
appendLeaseEvent("register",
|
|
4730
|
-
return
|
|
4729
|
+
appendLeaseEvent("register", record2, options);
|
|
4730
|
+
return record2;
|
|
4731
4731
|
}
|
|
4732
4732
|
function listProcessLeases(options) {
|
|
4733
4733
|
const leases = readActiveStore(options).leases;
|
|
@@ -5047,6 +5047,15 @@ var init_network_egress_policy = __esm({
|
|
|
5047
5047
|
}
|
|
5048
5048
|
});
|
|
5049
5049
|
|
|
5050
|
+
// packages/execution/dist/tool-output-spool.js
|
|
5051
|
+
var TOOL_OUTPUT_LIMITS;
|
|
5052
|
+
var init_tool_output_spool = __esm({
|
|
5053
|
+
"packages/execution/dist/tool-output-spool.js"() {
|
|
5054
|
+
"use strict";
|
|
5055
|
+
TOOL_OUTPUT_LIMITS = Object.freeze({ perProcessBytes: 16 * 1024 * 1024, workspaceBytes: 256 * 1024 * 1024, pageBytes: 65536, entries: 4096 });
|
|
5056
|
+
}
|
|
5057
|
+
});
|
|
5058
|
+
|
|
5050
5059
|
// packages/execution/dist/shell-runs.js
|
|
5051
5060
|
var init_shell_runs = __esm({
|
|
5052
5061
|
"packages/execution/dist/shell-runs.js"() {
|
|
@@ -5142,6 +5151,7 @@ var init_shell_observation_only = __esm({
|
|
|
5142
5151
|
var init_shell = __esm({
|
|
5143
5152
|
"packages/execution/dist/tools/shell.js"() {
|
|
5144
5153
|
"use strict";
|
|
5154
|
+
init_tool_output_spool();
|
|
5145
5155
|
init_shell_runs();
|
|
5146
5156
|
init_shell_run_control();
|
|
5147
5157
|
init_process_kill();
|
|
@@ -5157,6 +5167,71 @@ var init_shell = __esm({
|
|
|
5157
5167
|
}
|
|
5158
5168
|
});
|
|
5159
5169
|
|
|
5170
|
+
// packages/execution/dist/work-mode-capability.js
|
|
5171
|
+
var init_work_mode_capability = __esm({
|
|
5172
|
+
"packages/execution/dist/work-mode-capability.js"() {
|
|
5173
|
+
"use strict";
|
|
5174
|
+
}
|
|
5175
|
+
});
|
|
5176
|
+
|
|
5177
|
+
// packages/execution/dist/tools/change-log.js
|
|
5178
|
+
import { randomBytes } from "node:crypto";
|
|
5179
|
+
var _sessionId;
|
|
5180
|
+
var init_change_log = __esm({
|
|
5181
|
+
"packages/execution/dist/tools/change-log.js"() {
|
|
5182
|
+
"use strict";
|
|
5183
|
+
_sessionId = `session-${Date.now()}-${randomBytes(3).toString("hex")}`;
|
|
5184
|
+
}
|
|
5185
|
+
});
|
|
5186
|
+
|
|
5187
|
+
// packages/execution/dist/tools/edit-metadata.js
|
|
5188
|
+
var init_edit_metadata = __esm({
|
|
5189
|
+
"packages/execution/dist/tools/edit-metadata.js"() {
|
|
5190
|
+
"use strict";
|
|
5191
|
+
}
|
|
5192
|
+
});
|
|
5193
|
+
|
|
5194
|
+
// packages/execution/dist/tools/text-encoding.js
|
|
5195
|
+
import { TextDecoder as TextDecoder2 } from "node:util";
|
|
5196
|
+
var UTF8_DECODER;
|
|
5197
|
+
var init_text_encoding = __esm({
|
|
5198
|
+
"packages/execution/dist/tools/text-encoding.js"() {
|
|
5199
|
+
"use strict";
|
|
5200
|
+
UTF8_DECODER = new TextDecoder2("utf-8", { fatal: true });
|
|
5201
|
+
}
|
|
5202
|
+
});
|
|
5203
|
+
|
|
5204
|
+
// packages/execution/dist/tools/file-mutation.js
|
|
5205
|
+
import { TextDecoder as TextDecoder3 } from "node:util";
|
|
5206
|
+
var utf8;
|
|
5207
|
+
var init_file_mutation = __esm({
|
|
5208
|
+
"packages/execution/dist/tools/file-mutation.js"() {
|
|
5209
|
+
"use strict";
|
|
5210
|
+
init_edit_metadata();
|
|
5211
|
+
utf8 = new TextDecoder3("utf-8", { fatal: true, ignoreBOM: true });
|
|
5212
|
+
}
|
|
5213
|
+
});
|
|
5214
|
+
|
|
5215
|
+
// packages/execution/dist/tools/file-write.js
|
|
5216
|
+
var init_file_write = __esm({
|
|
5217
|
+
"packages/execution/dist/tools/file-write.js"() {
|
|
5218
|
+
"use strict";
|
|
5219
|
+
init_work_mode_capability();
|
|
5220
|
+
init_change_log();
|
|
5221
|
+
init_edit_metadata();
|
|
5222
|
+
init_text_encoding();
|
|
5223
|
+
init_file_mutation();
|
|
5224
|
+
}
|
|
5225
|
+
});
|
|
5226
|
+
|
|
5227
|
+
// packages/execution/dist/native-file-write-observation.js
|
|
5228
|
+
var init_native_file_write_observation = __esm({
|
|
5229
|
+
"packages/execution/dist/native-file-write-observation.js"() {
|
|
5230
|
+
"use strict";
|
|
5231
|
+
init_file_write();
|
|
5232
|
+
}
|
|
5233
|
+
});
|
|
5234
|
+
|
|
5160
5235
|
// packages/execution/dist/tools/debate.js
|
|
5161
5236
|
var init_debate = __esm({
|
|
5162
5237
|
"packages/execution/dist/tools/debate.js"() {
|
|
@@ -5178,13 +5253,6 @@ var init_semantic_map = __esm({
|
|
|
5178
5253
|
}
|
|
5179
5254
|
});
|
|
5180
5255
|
|
|
5181
|
-
// packages/execution/dist/tools/edit-metadata.js
|
|
5182
|
-
var init_edit_metadata = __esm({
|
|
5183
|
-
"packages/execution/dist/tools/edit-metadata.js"() {
|
|
5184
|
-
"use strict";
|
|
5185
|
-
}
|
|
5186
|
-
});
|
|
5187
|
-
|
|
5188
5256
|
// packages/execution/dist/tools/file-read-output.js
|
|
5189
5257
|
var init_file_read_output = __esm({
|
|
5190
5258
|
"packages/execution/dist/tools/file-read-output.js"() {
|
|
@@ -5196,6 +5264,7 @@ var init_file_read_output = __esm({
|
|
|
5196
5264
|
var init_file_read = __esm({
|
|
5197
5265
|
"packages/execution/dist/tools/file-read.js"() {
|
|
5198
5266
|
"use strict";
|
|
5267
|
+
init_work_mode_capability();
|
|
5199
5268
|
init_semantic_map();
|
|
5200
5269
|
init_edit_metadata();
|
|
5201
5270
|
init_file_read_output();
|
|
@@ -5347,48 +5416,6 @@ except BaseException as error:
|
|
|
5347
5416
|
}
|
|
5348
5417
|
});
|
|
5349
5418
|
|
|
5350
|
-
// packages/execution/dist/tools/change-log.js
|
|
5351
|
-
import { randomBytes } from "node:crypto";
|
|
5352
|
-
var _sessionId;
|
|
5353
|
-
var init_change_log = __esm({
|
|
5354
|
-
"packages/execution/dist/tools/change-log.js"() {
|
|
5355
|
-
"use strict";
|
|
5356
|
-
_sessionId = `session-${Date.now()}-${randomBytes(3).toString("hex")}`;
|
|
5357
|
-
}
|
|
5358
|
-
});
|
|
5359
|
-
|
|
5360
|
-
// packages/execution/dist/tools/text-encoding.js
|
|
5361
|
-
import { TextDecoder as TextDecoder2 } from "node:util";
|
|
5362
|
-
var UTF8_DECODER;
|
|
5363
|
-
var init_text_encoding = __esm({
|
|
5364
|
-
"packages/execution/dist/tools/text-encoding.js"() {
|
|
5365
|
-
"use strict";
|
|
5366
|
-
UTF8_DECODER = new TextDecoder2("utf-8", { fatal: true });
|
|
5367
|
-
}
|
|
5368
|
-
});
|
|
5369
|
-
|
|
5370
|
-
// packages/execution/dist/tools/file-mutation.js
|
|
5371
|
-
import { TextDecoder as TextDecoder3 } from "node:util";
|
|
5372
|
-
var utf8;
|
|
5373
|
-
var init_file_mutation = __esm({
|
|
5374
|
-
"packages/execution/dist/tools/file-mutation.js"() {
|
|
5375
|
-
"use strict";
|
|
5376
|
-
init_edit_metadata();
|
|
5377
|
-
utf8 = new TextDecoder3("utf-8", { fatal: true, ignoreBOM: true });
|
|
5378
|
-
}
|
|
5379
|
-
});
|
|
5380
|
-
|
|
5381
|
-
// packages/execution/dist/tools/file-write.js
|
|
5382
|
-
var init_file_write = __esm({
|
|
5383
|
-
"packages/execution/dist/tools/file-write.js"() {
|
|
5384
|
-
"use strict";
|
|
5385
|
-
init_change_log();
|
|
5386
|
-
init_edit_metadata();
|
|
5387
|
-
init_text_encoding();
|
|
5388
|
-
init_file_mutation();
|
|
5389
|
-
}
|
|
5390
|
-
});
|
|
5391
|
-
|
|
5392
5419
|
// packages/execution/dist/tools/grep-search.js
|
|
5393
5420
|
import { execFile as execFile2 } from "node:child_process";
|
|
5394
5421
|
import { promisify as promisify2 } from "node:util";
|
|
@@ -7256,6 +7283,7 @@ var init_esm3 = __esm({
|
|
|
7256
7283
|
var init_glob_find = __esm({
|
|
7257
7284
|
"packages/execution/dist/tools/glob-find.js"() {
|
|
7258
7285
|
"use strict";
|
|
7286
|
+
init_work_mode_capability();
|
|
7259
7287
|
init_esm3();
|
|
7260
7288
|
}
|
|
7261
7289
|
});
|
|
@@ -53779,6 +53807,7 @@ var init_edit_snippet_finder = __esm({
|
|
|
53779
53807
|
var init_file_edit = __esm({
|
|
53780
53808
|
"packages/execution/dist/tools/file-edit.js"() {
|
|
53781
53809
|
"use strict";
|
|
53810
|
+
init_work_mode_capability();
|
|
53782
53811
|
init_change_log();
|
|
53783
53812
|
init_edit_snippet_finder();
|
|
53784
53813
|
init_edit_metadata();
|
|
@@ -53787,6 +53816,78 @@ var init_file_edit = __esm({
|
|
|
53787
53816
|
}
|
|
53788
53817
|
});
|
|
53789
53818
|
|
|
53819
|
+
// packages/memory/dist/memoryCapability.js
|
|
53820
|
+
import { createHash as createHash3, randomUUID as randomUUID3 } from "node:crypto";
|
|
53821
|
+
function canonical(value, depth = 0) {
|
|
53822
|
+
if (depth > 32)
|
|
53823
|
+
throw new MemoryContractError("value_depth_exceeded");
|
|
53824
|
+
if (value === null || typeof value === "string" || typeof value === "boolean")
|
|
53825
|
+
return JSON.stringify(value);
|
|
53826
|
+
if (typeof value === "number" && Number.isFinite(value))
|
|
53827
|
+
return JSON.stringify(value);
|
|
53828
|
+
if (Array.isArray(value))
|
|
53829
|
+
return `[${value.map((v) => canonical(v, depth + 1)).join(",")}]`;
|
|
53830
|
+
if (record(value) && (Object.getPrototypeOf(value) === Object.prototype || Object.getPrototypeOf(value) === null))
|
|
53831
|
+
return `{${Object.keys(value).filter((k) => value[k] !== void 0).sort().map((k) => `${JSON.stringify(k)}:${canonical(value[k], depth + 1)}`).join(",")}}`;
|
|
53832
|
+
throw new MemoryContractError("non_json_value");
|
|
53833
|
+
}
|
|
53834
|
+
var MEMORY_NAMESPACES, MEMORY_CONTRACT_LIMITS, MemoryContractError, record, memoryContentHash, stableMemoryHash, UNBOUND;
|
|
53835
|
+
var init_memoryCapability = __esm({
|
|
53836
|
+
"packages/memory/dist/memoryCapability.js"() {
|
|
53837
|
+
"use strict";
|
|
53838
|
+
MEMORY_NAMESPACES = Object.freeze({
|
|
53839
|
+
projectUnified: "project_unified_memory",
|
|
53840
|
+
projectLegacy: "project_legacy_memory",
|
|
53841
|
+
telegramChat: "telegram_chat",
|
|
53842
|
+
task: "task_evidence",
|
|
53843
|
+
structured: "structured_records",
|
|
53844
|
+
folds: "context_folds",
|
|
53845
|
+
procedures: "successful_procedures"
|
|
53846
|
+
});
|
|
53847
|
+
MEMORY_CONTRACT_LIMITS = Object.freeze({
|
|
53848
|
+
scopes: 64,
|
|
53849
|
+
scopeIds: 256,
|
|
53850
|
+
matches: 100,
|
|
53851
|
+
branches: 16,
|
|
53852
|
+
stages: 64,
|
|
53853
|
+
sourceRefs: 512,
|
|
53854
|
+
spans: 128,
|
|
53855
|
+
parents: 128,
|
|
53856
|
+
textChars: 65536,
|
|
53857
|
+
fieldChars: 512,
|
|
53858
|
+
routes: 32,
|
|
53859
|
+
traceBytes: 262144
|
|
53860
|
+
});
|
|
53861
|
+
MemoryContractError = class extends Error {
|
|
53862
|
+
code;
|
|
53863
|
+
constructor(code) {
|
|
53864
|
+
super(`Memory contract: ${code}`);
|
|
53865
|
+
this.code = code;
|
|
53866
|
+
this.name = "MemoryContractError";
|
|
53867
|
+
}
|
|
53868
|
+
};
|
|
53869
|
+
record = (x) => !!x && typeof x === "object" && !Array.isArray(x);
|
|
53870
|
+
memoryContentHash = (value) => createHash3("sha256").update(value).digest("hex");
|
|
53871
|
+
stableMemoryHash = (value) => memoryContentHash(canonical(value));
|
|
53872
|
+
UNBOUND = stableMemoryHash({ memoryBinding: "unavailable" });
|
|
53873
|
+
}
|
|
53874
|
+
});
|
|
53875
|
+
|
|
53876
|
+
// packages/memory/dist/memorySourceResolver.js
|
|
53877
|
+
var init_memorySourceResolver = __esm({
|
|
53878
|
+
"packages/memory/dist/memorySourceResolver.js"() {
|
|
53879
|
+
"use strict";
|
|
53880
|
+
init_memoryCapability();
|
|
53881
|
+
}
|
|
53882
|
+
});
|
|
53883
|
+
|
|
53884
|
+
// packages/memory/dist/candidateCoverage.js
|
|
53885
|
+
var init_candidateCoverage = __esm({
|
|
53886
|
+
"packages/memory/dist/candidateCoverage.js"() {
|
|
53887
|
+
"use strict";
|
|
53888
|
+
}
|
|
53889
|
+
});
|
|
53890
|
+
|
|
53790
53891
|
// packages/memory/dist/db.js
|
|
53791
53892
|
var init_db = __esm({
|
|
53792
53893
|
"packages/memory/dist/db.js"() {
|
|
@@ -53850,6 +53951,7 @@ var init_evidenceIngestion = __esm({
|
|
|
53850
53951
|
var init_structuredMemoryStore = __esm({
|
|
53851
53952
|
"packages/memory/dist/structuredMemoryStore.js"() {
|
|
53852
53953
|
"use strict";
|
|
53954
|
+
init_memoryCapability();
|
|
53853
53955
|
}
|
|
53854
53956
|
});
|
|
53855
53957
|
|
|
@@ -53895,6 +53997,7 @@ var MEMORY_JOB_CLAIM_LEASE_MS;
|
|
|
53895
53997
|
var init_unifiedMemoryStore = __esm({
|
|
53896
53998
|
"packages/memory/dist/unifiedMemoryStore.js"() {
|
|
53897
53999
|
"use strict";
|
|
54000
|
+
init_candidateCoverage();
|
|
53898
54001
|
init_memoryChunker();
|
|
53899
54002
|
MEMORY_JOB_CLAIM_LEASE_MS = 5 * 6e4;
|
|
53900
54003
|
}
|
|
@@ -53904,6 +54007,7 @@ var init_unifiedMemoryStore = __esm({
|
|
|
53904
54007
|
var init_hybridMemoryRetriever = __esm({
|
|
53905
54008
|
"packages/memory/dist/hybridMemoryRetriever.js"() {
|
|
53906
54009
|
"use strict";
|
|
54010
|
+
init_candidateCoverage();
|
|
53907
54011
|
init_unifiedMemoryStore();
|
|
53908
54012
|
}
|
|
53909
54013
|
});
|
|
@@ -54045,6 +54149,7 @@ var init_embodiedTrace = __esm({
|
|
|
54045
54149
|
var init_pprRetrieval = __esm({
|
|
54046
54150
|
"packages/memory/dist/pprRetrieval.js"() {
|
|
54047
54151
|
"use strict";
|
|
54152
|
+
init_candidateCoverage();
|
|
54048
54153
|
init_zettelkasten();
|
|
54049
54154
|
init_homeostaticRegulation();
|
|
54050
54155
|
init_socialInfluence();
|
|
@@ -54057,6 +54162,7 @@ var init_episodeStore = __esm({
|
|
|
54057
54162
|
"packages/memory/dist/episodeStore.js"() {
|
|
54058
54163
|
"use strict";
|
|
54059
54164
|
init_db();
|
|
54165
|
+
init_candidateCoverage();
|
|
54060
54166
|
init_zettelkasten();
|
|
54061
54167
|
init_homeostaticRegulation();
|
|
54062
54168
|
init_socialInfluence();
|
|
@@ -54106,6 +54212,7 @@ var init_speakerIdentityStore = __esm({
|
|
|
54106
54212
|
var init_temporalGraph = __esm({
|
|
54107
54213
|
"packages/memory/dist/temporalGraph.js"() {
|
|
54108
54214
|
"use strict";
|
|
54215
|
+
init_candidateCoverage();
|
|
54109
54216
|
init_db();
|
|
54110
54217
|
}
|
|
54111
54218
|
});
|
|
@@ -55186,7 +55293,10 @@ var init_evidence_retirement = __esm({
|
|
|
55186
55293
|
var init_dist3 = __esm({
|
|
55187
55294
|
"packages/memory/dist/index.js"() {
|
|
55188
55295
|
"use strict";
|
|
55296
|
+
init_memorySourceResolver();
|
|
55297
|
+
init_candidateCoverage();
|
|
55189
55298
|
init_db();
|
|
55299
|
+
init_memoryCapability();
|
|
55190
55300
|
init_contextMemoryLedger();
|
|
55191
55301
|
init_immutableEvidenceStore();
|
|
55192
55302
|
init_artifactReviewSourceIndex();
|
|
@@ -55255,11 +55365,37 @@ var init_dist3 = __esm({
|
|
|
55255
55365
|
}
|
|
55256
55366
|
});
|
|
55257
55367
|
|
|
55368
|
+
// packages/execution/dist/tools/memory-operation-contract.js
|
|
55369
|
+
var init_memory_operation_contract = __esm({
|
|
55370
|
+
"packages/execution/dist/tools/memory-operation-contract.js"() {
|
|
55371
|
+
"use strict";
|
|
55372
|
+
}
|
|
55373
|
+
});
|
|
55374
|
+
|
|
55375
|
+
// packages/execution/dist/tools/legacy-memory-view.js
|
|
55376
|
+
var init_legacy_memory_view = __esm({
|
|
55377
|
+
"packages/execution/dist/tools/legacy-memory-view.js"() {
|
|
55378
|
+
"use strict";
|
|
55379
|
+
init_dist3();
|
|
55380
|
+
}
|
|
55381
|
+
});
|
|
55382
|
+
|
|
55383
|
+
// packages/execution/dist/tools/memory-source-adapter.js
|
|
55384
|
+
var init_memory_source_adapter = __esm({
|
|
55385
|
+
"packages/execution/dist/tools/memory-source-adapter.js"() {
|
|
55386
|
+
"use strict";
|
|
55387
|
+
init_memory_operation_contract();
|
|
55388
|
+
init_dist3();
|
|
55389
|
+
init_legacy_memory_view();
|
|
55390
|
+
}
|
|
55391
|
+
});
|
|
55392
|
+
|
|
55258
55393
|
// packages/execution/dist/tools/memory-read.js
|
|
55259
55394
|
var init_memory_read = __esm({
|
|
55260
55395
|
"packages/execution/dist/tools/memory-read.js"() {
|
|
55261
55396
|
"use strict";
|
|
55262
55397
|
init_dist3();
|
|
55398
|
+
init_memory_source_adapter();
|
|
55263
55399
|
}
|
|
55264
55400
|
});
|
|
55265
55401
|
|
|
@@ -55271,12 +55407,23 @@ var init_memory_write = __esm({
|
|
|
55271
55407
|
}
|
|
55272
55408
|
});
|
|
55273
55409
|
|
|
55410
|
+
// packages/execution/dist/native-memory-view-provider.js
|
|
55411
|
+
var init_native_memory_view_provider = __esm({
|
|
55412
|
+
"packages/execution/dist/native-memory-view-provider.js"() {
|
|
55413
|
+
"use strict";
|
|
55414
|
+
}
|
|
55415
|
+
});
|
|
55416
|
+
|
|
55274
55417
|
// packages/execution/dist/tools/memory-search.js
|
|
55275
55418
|
var DEFAULT_INLINE_KG_MAX_BYTES, DEFAULT_INLINE_EPISODES_MAX_BYTES;
|
|
55276
55419
|
var init_memory_search = __esm({
|
|
55277
55420
|
"packages/execution/dist/tools/memory-search.js"() {
|
|
55278
55421
|
"use strict";
|
|
55422
|
+
init_memory_operation_contract();
|
|
55423
|
+
init_native_memory_view_provider();
|
|
55424
|
+
init_memory_source_adapter();
|
|
55279
55425
|
init_dist3();
|
|
55426
|
+
init_legacy_memory_view();
|
|
55280
55427
|
DEFAULT_INLINE_KG_MAX_BYTES = 512 * 1024 * 1024;
|
|
55281
55428
|
DEFAULT_INLINE_EPISODES_MAX_BYTES = 1024 * 1024 * 1024;
|
|
55282
55429
|
}
|
|
@@ -55308,6 +55455,7 @@ var init_explore_tools = __esm({
|
|
|
55308
55455
|
var init_list_directory = __esm({
|
|
55309
55456
|
"packages/execution/dist/tools/list-directory.js"() {
|
|
55310
55457
|
"use strict";
|
|
55458
|
+
init_work_mode_capability();
|
|
55311
55459
|
}
|
|
55312
55460
|
});
|
|
55313
55461
|
|
|
@@ -55364,6 +55512,7 @@ var init_batch_edit = __esm({
|
|
|
55364
55512
|
var init_file_patch = __esm({
|
|
55365
55513
|
"packages/execution/dist/tools/file-patch.js"() {
|
|
55366
55514
|
"use strict";
|
|
55515
|
+
init_work_mode_capability();
|
|
55367
55516
|
init_change_log();
|
|
55368
55517
|
init_edit_metadata();
|
|
55369
55518
|
init_text_encoding();
|
|
@@ -55397,6 +55546,7 @@ var init_git_info = __esm({
|
|
|
55397
55546
|
var init_background_task = __esm({
|
|
55398
55547
|
"packages/execution/dist/tools/background-task.js"() {
|
|
55399
55548
|
"use strict";
|
|
55549
|
+
init_tool_output_spool();
|
|
55400
55550
|
init_shell_runs();
|
|
55401
55551
|
init_shell_run_control();
|
|
55402
55552
|
init_background_process_receipt();
|
|
@@ -55650,7 +55800,6 @@ var init_safe_python = __esm({
|
|
|
55650
55800
|
var init_repl = __esm({
|
|
55651
55801
|
"packages/execution/dist/tools/repl.js"() {
|
|
55652
55802
|
"use strict";
|
|
55653
|
-
init_process_kill();
|
|
55654
55803
|
init_process_lifecycle();
|
|
55655
55804
|
}
|
|
55656
55805
|
});
|
|
@@ -135735,13 +135884,13 @@ ${lanes.join("\n")}
|
|
|
135735
135884
|
if (!headMessage2 && maybeSuppress) {
|
|
135736
135885
|
const savedErrorState = captureErrorCalculationState();
|
|
135737
135886
|
reportRelationError(headMessage2, source2, target2);
|
|
135738
|
-
let
|
|
135887
|
+
let canonical2;
|
|
135739
135888
|
if (errorInfo && errorInfo !== savedErrorState.errorInfo) {
|
|
135740
|
-
|
|
135889
|
+
canonical2 = { code: errorInfo.code, messageText: errorInfo.messageText };
|
|
135741
135890
|
}
|
|
135742
135891
|
resetErrorInfo(savedErrorState);
|
|
135743
|
-
if (
|
|
135744
|
-
errorInfo.canonicalHead =
|
|
135892
|
+
if (canonical2 && errorInfo) {
|
|
135893
|
+
errorInfo.canonicalHead = canonical2;
|
|
135745
135894
|
}
|
|
135746
135895
|
lastSkippedInfo = [source2, target2];
|
|
135747
135896
|
return;
|
|
@@ -303724,6 +303873,8 @@ var init_dist5 = __esm({
|
|
|
303724
303873
|
init_provenance();
|
|
303725
303874
|
init_network_egress_policy();
|
|
303726
303875
|
init_shell();
|
|
303876
|
+
init_native_file_write_observation();
|
|
303877
|
+
init_tool_output_spool();
|
|
303727
303878
|
init_shell_runs();
|
|
303728
303879
|
init_debate();
|
|
303729
303880
|
init_replay_with_intervention();
|
|
@@ -303919,6 +304070,9 @@ var init_dist5 = __esm({
|
|
|
303919
304070
|
init_ocr_pdf();
|
|
303920
304071
|
init_qwen35_head_sites();
|
|
303921
304072
|
init_distributions();
|
|
304073
|
+
init_work_mode_capability();
|
|
304074
|
+
init_native_memory_view_provider();
|
|
304075
|
+
init_memory_operation_contract();
|
|
303922
304076
|
}
|
|
303923
304077
|
});
|
|
303924
304078
|
|
|
@@ -304035,44 +304189,44 @@ function readRecord(port, now, options) {
|
|
|
304035
304189
|
lastReason: "supervision_state_invalid"
|
|
304036
304190
|
};
|
|
304037
304191
|
}
|
|
304038
|
-
function pruneExpiredAttempts(
|
|
304192
|
+
function pruneExpiredAttempts(record2, now, policy) {
|
|
304039
304193
|
const cutoff = now - policy.windowMs;
|
|
304040
|
-
const attempts =
|
|
304041
|
-
if (attempts.length ===
|
|
304194
|
+
const attempts = record2.attempts.filter((attempt) => attempt.at >= cutoff);
|
|
304195
|
+
if (attempts.length === record2.attempts.length) return record2;
|
|
304042
304196
|
return {
|
|
304043
|
-
...
|
|
304197
|
+
...record2,
|
|
304044
304198
|
attempts,
|
|
304045
|
-
phase: attempts.length === 0 ? "healthy" :
|
|
304046
|
-
nextAttemptAt: attempts.length === 0 ? null :
|
|
304047
|
-
degradedSince: attempts.length === 0 ? null :
|
|
304048
|
-
lastReason: attempts.length === 0 ? "restart_window_elapsed" :
|
|
304199
|
+
phase: attempts.length === 0 ? "healthy" : record2.phase,
|
|
304200
|
+
nextAttemptAt: attempts.length === 0 ? null : record2.nextAttemptAt,
|
|
304201
|
+
degradedSince: attempts.length === 0 ? null : record2.degradedSince,
|
|
304202
|
+
lastReason: attempts.length === 0 ? "restart_window_elapsed" : record2.lastReason,
|
|
304049
304203
|
updatedAt: now
|
|
304050
304204
|
};
|
|
304051
304205
|
}
|
|
304052
|
-
function toHealth(
|
|
304053
|
-
const retryAfterMs =
|
|
304206
|
+
function toHealth(record2, now, policy) {
|
|
304207
|
+
const retryAfterMs = record2.nextAttemptAt === null ? 0 : Math.max(0, record2.nextAttemptAt - now);
|
|
304054
304208
|
return {
|
|
304055
304209
|
schema: DAEMON_SUPERVISION_SCHEMA,
|
|
304056
|
-
phase:
|
|
304057
|
-
degraded:
|
|
304058
|
-
restartCount:
|
|
304210
|
+
phase: record2.phase,
|
|
304211
|
+
degraded: record2.phase === "degraded_backoff" || record2.phase === "degraded_open",
|
|
304212
|
+
restartCount: record2.attempts.length,
|
|
304059
304213
|
windowMs: policy.windowMs,
|
|
304060
304214
|
maxStartsInWindow: policy.maxStartsInWindow,
|
|
304061
|
-
nextAttemptAt:
|
|
304215
|
+
nextAttemptAt: record2.nextAttemptAt,
|
|
304062
304216
|
retryAfterMs,
|
|
304063
|
-
lastStartAt:
|
|
304064
|
-
lastHealthyAt:
|
|
304065
|
-
degradedSince:
|
|
304066
|
-
lastReason:
|
|
304067
|
-
lastResetAt:
|
|
304068
|
-
lastResetBy:
|
|
304217
|
+
lastStartAt: record2.lastStartAt,
|
|
304218
|
+
lastHealthyAt: record2.lastHealthyAt,
|
|
304219
|
+
degradedSince: record2.degradedSince,
|
|
304220
|
+
lastReason: record2.lastReason,
|
|
304221
|
+
lastResetAt: record2.lastResetAt,
|
|
304222
|
+
lastResetBy: record2.lastResetBy
|
|
304069
304223
|
};
|
|
304070
304224
|
}
|
|
304071
304225
|
function readDaemonSupervisionHealth(port, options = {}) {
|
|
304072
304226
|
const now = options.now?.() ?? Date.now();
|
|
304073
304227
|
const policy = options.policy ?? daemonSupervisionPolicy();
|
|
304074
|
-
const
|
|
304075
|
-
return toHealth(
|
|
304228
|
+
const record2 = pruneExpiredAttempts(readRecord(port, now, options), now, policy);
|
|
304229
|
+
return toHealth(record2, now, policy);
|
|
304076
304230
|
}
|
|
304077
304231
|
var DAEMON_SUPERVISION_SCHEMA;
|
|
304078
304232
|
var init_daemon_supervision = __esm({
|
|
@@ -304472,7 +304626,7 @@ function claimDaemonEndpoint(port = getDaemonPort(), inheritedToken) {
|
|
|
304472
304626
|
const lockFile = daemonLockFile(port);
|
|
304473
304627
|
for (let attempt = 0; attempt < 3; attempt++) {
|
|
304474
304628
|
const token = inheritedToken ?? newDaemonLockToken();
|
|
304475
|
-
const
|
|
304629
|
+
const record2 = {
|
|
304476
304630
|
endpoint,
|
|
304477
304631
|
pid: process.pid,
|
|
304478
304632
|
token,
|
|
@@ -304481,7 +304635,7 @@ function claimDaemonEndpoint(port = getDaemonPort(), inheritedToken) {
|
|
|
304481
304635
|
let fd = null;
|
|
304482
304636
|
try {
|
|
304483
304637
|
fd = openSync2(lockFile, "wx", 384);
|
|
304484
|
-
writeSync(fd, JSON.stringify(
|
|
304638
|
+
writeSync(fd, JSON.stringify(record2));
|
|
304485
304639
|
closeSync2(fd);
|
|
304486
304640
|
return { endpoint, lockFile, pid: process.pid, port, token };
|
|
304487
304641
|
} catch (error) {
|
|
@@ -304779,15 +304933,15 @@ function removeDaemonLockIfUnchanged(port, expected) {
|
|
|
304779
304933
|
}
|
|
304780
304934
|
}
|
|
304781
304935
|
async function reclaimStaleDaemonEndpointClaim(port, verifiedStoppedPids = /* @__PURE__ */ new Set(), dependencies = DEFAULT_CLAIM_RECLAIM_DEPENDENCIES) {
|
|
304782
|
-
const
|
|
304783
|
-
if (!
|
|
304936
|
+
const record2 = dependencies.readLock(port);
|
|
304937
|
+
if (!record2) return dependencies.portIsFree(port);
|
|
304784
304938
|
if (!await dependencies.portIsFree(port)) return false;
|
|
304785
|
-
const clearExactClaim = async () => dependencies.removeLockIfUnchanged(port,
|
|
304786
|
-
if (verifiedStoppedPids.has(
|
|
304939
|
+
const clearExactClaim = async () => dependencies.removeLockIfUnchanged(port, record2) && dependencies.portIsFree(port);
|
|
304940
|
+
if (verifiedStoppedPids.has(record2.pid) || !dependencies.processIsAlive(record2.pid)) {
|
|
304787
304941
|
return clearExactClaim();
|
|
304788
304942
|
}
|
|
304789
304943
|
const lease = dependencies.leases().find(
|
|
304790
|
-
(item) => item.status === "active" && item.pid ===
|
|
304944
|
+
(item) => item.status === "active" && item.pid === record2.pid && item.ownerKind === "daemon" && item.ownerId === `daemon:${port}`
|
|
304791
304945
|
);
|
|
304792
304946
|
if (!lease) return false;
|
|
304793
304947
|
const stopped = await dependencies.stopLease(lease.leaseId, port);
|
|
@@ -305095,7 +305249,7 @@ import { spawn as spawn5 } from "node:child_process";
|
|
|
305095
305249
|
|
|
305096
305250
|
// packages/cli/src/update-service.ts
|
|
305097
305251
|
import { spawn as spawn3 } from "node:child_process";
|
|
305098
|
-
import { createHash as
|
|
305252
|
+
import { createHash as createHash5, randomUUID as randomUUID5 } from "node:crypto";
|
|
305099
305253
|
import {
|
|
305100
305254
|
constants as constants3,
|
|
305101
305255
|
chmodSync,
|
|
@@ -305224,7 +305378,7 @@ async function pruneStaleUpdateRecoveries(modulesRoot, options = {}) {
|
|
|
305224
305378
|
}
|
|
305225
305379
|
|
|
305226
305380
|
// packages/cli/src/npm-install-recovery.ts
|
|
305227
|
-
import { createHash as
|
|
305381
|
+
import { createHash as createHash4, randomUUID as randomUUID4 } from "node:crypto";
|
|
305228
305382
|
import { closeSync as closeSync3, constants as constants2, fstatSync, fsyncSync, ftruncateSync, lstatSync as lstatSync3, openSync as openSync3, readFileSync as readFileSync7, readdirSync, readSync as readSync2, unlinkSync as unlinkSync3, writeFileSync as writeFileSync5 } from "node:fs";
|
|
305229
305383
|
import { chmod, cp, lstat as lstat2, mkdir, readdir as readdir2, realpath, rename, rm as rm2 } from "node:fs/promises";
|
|
305230
305384
|
import { basename as basename8, dirname as dirname9, isAbsolute as isAbsolute7, join as join17, resolve as resolve11 } from "node:path";
|
|
@@ -305252,7 +305406,7 @@ function parseNpmRenameCollision(diagnostic) {
|
|
|
305252
305406
|
return { code, syscall: "rename", path: path3, dest };
|
|
305253
305407
|
}
|
|
305254
305408
|
function retiredNpmPackagePath(packagePath) {
|
|
305255
|
-
const suffix =
|
|
305409
|
+
const suffix = createHash4("sha1").update(packagePath).digest("base64").replace(/[^a-zA-Z0-9]/g, "").slice(0, 8);
|
|
305256
305410
|
return join17(dirname9(packagePath), `.${basename8(packagePath)}-${suffix}`);
|
|
305257
305411
|
}
|
|
305258
305412
|
function assertNotCancelled(signal) {
|
|
@@ -305293,7 +305447,7 @@ async function prepareNpmRetirementSlot(modulesRoot, options = {}) {
|
|
|
305293
305447
|
throw error;
|
|
305294
305448
|
}
|
|
305295
305449
|
assertOwnedDirectory(before, "retired package");
|
|
305296
|
-
const backup = join17(root, `.omnius-update-recovery-${
|
|
305450
|
+
const backup = join17(root, `.omnius-update-recovery-${randomUUID4()}`);
|
|
305297
305451
|
const receipt = { modulesRoot: root, retiredPath: retired, backupPath: backup, device: before.dev, inode: before.ino };
|
|
305298
305452
|
current();
|
|
305299
305453
|
await options.onPrepare?.({ ...receipt });
|
|
@@ -305428,7 +305582,7 @@ async function acquireNpmInstallLease(modulesRoot, options = {}) {
|
|
|
305428
305582
|
const root = await realpath(logical), rootMetadata = await lstat2(root);
|
|
305429
305583
|
assertOwnedDirectory(rootMetadata, "global modules root");
|
|
305430
305584
|
if (!sameIdentity(logicalMetadata, rootMetadata)) throw new Error("npm modules root changed before installer admission.");
|
|
305431
|
-
const lockPath = join17(root, ".omnius-install.lock"), guardPath = lockPath + ".guard", nonce =
|
|
305585
|
+
const lockPath = join17(root, ".omnius-install.lock"), guardPath = lockPath + ".guard", nonce = randomUUID4();
|
|
305432
305586
|
const assertRoot = () => {
|
|
305433
305587
|
const current = lstatSync3(root);
|
|
305434
305588
|
assertOwnedDirectory(current, "global modules root");
|
|
@@ -305447,7 +305601,7 @@ async function acquireNpmInstallLease(modulesRoot, options = {}) {
|
|
|
305447
305601
|
const withGuard = (action) => {
|
|
305448
305602
|
assertRoot();
|
|
305449
305603
|
const fd = openGuard();
|
|
305450
|
-
const metadata = fstatSync(fd), guardNonce =
|
|
305604
|
+
const metadata = fstatSync(fd), guardNonce = randomUUID4();
|
|
305451
305605
|
let recorded = false;
|
|
305452
305606
|
try {
|
|
305453
305607
|
writeFileSync5(fd, JSON.stringify({ schema_version: 1, nonce: guardNonce, pid: process.pid, process_identity: processIdentity(process.pid) }));
|
|
@@ -305554,7 +305708,7 @@ function hashOwnedFile(path3) {
|
|
|
305554
305708
|
try {
|
|
305555
305709
|
const metadata = fstatSync(fd);
|
|
305556
305710
|
if (!valid(metadata) || !sameIdentity(before, metadata)) throw new Error("Omnius runtime file changed during verification.");
|
|
305557
|
-
const hash =
|
|
305711
|
+
const hash = createHash4("sha256"), chunk = Buffer.alloc(64 * 1024);
|
|
305558
305712
|
let size = 0;
|
|
305559
305713
|
for (; ; ) {
|
|
305560
305714
|
const count4 = readSync2(fd, chunk, 0, chunk.length, null);
|
|
@@ -305572,29 +305726,29 @@ function hashOwnedFile(path3) {
|
|
|
305572
305726
|
}
|
|
305573
305727
|
}
|
|
305574
305728
|
function inspectNpmRuntimeInstallation(packagePath) {
|
|
305575
|
-
const
|
|
305576
|
-
if (!isAbsolute7(packagePath) || basename8(
|
|
305577
|
-
return inspectRuntimeDirectory(
|
|
305729
|
+
const canonical2 = resolve11(packagePath), root = dirname9(canonical2);
|
|
305730
|
+
if (!isAbsolute7(packagePath) || basename8(canonical2) !== "omnius") throw new Error("Runtime verification requires the canonical Omnius package path.");
|
|
305731
|
+
return inspectRuntimeDirectory(canonical2, root);
|
|
305578
305732
|
}
|
|
305579
|
-
function inspectRuntimeDirectory(
|
|
305580
|
-
const before = lstatSync3(
|
|
305733
|
+
function inspectRuntimeDirectory(canonical2, root) {
|
|
305734
|
+
const before = lstatSync3(canonical2);
|
|
305581
305735
|
assertOwnedDirectory(lstatSync3(root), "global modules root");
|
|
305582
305736
|
assertOwnedDirectory(before, "Omnius package");
|
|
305583
|
-
assertOwnedDirectory(lstatSync3(join17(
|
|
305737
|
+
assertOwnedDirectory(lstatSync3(join17(canonical2, "dist")), "Omnius runtime");
|
|
305584
305738
|
const files = {};
|
|
305585
|
-
for (const file of REQUIRED_OMNIUS_RUNTIME_FILES) files[file] = hashOwnedFile(join17(
|
|
305586
|
-
const manifest = JSON.parse(readFileSync7(join17(
|
|
305739
|
+
for (const file of REQUIRED_OMNIUS_RUNTIME_FILES) files[file] = hashOwnedFile(join17(canonical2, file));
|
|
305740
|
+
const manifest = JSON.parse(readFileSync7(join17(canonical2, "package.json"), "utf8"));
|
|
305587
305741
|
if (manifest.name !== "omnius" || typeof manifest.version !== "string" || !/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/.test(manifest.version))
|
|
305588
305742
|
throw new Error("Omnius runtime manifest is invalid.");
|
|
305589
305743
|
const binTarget = typeof manifest.bin === "string" ? manifest.bin : manifest.bin?.omnius;
|
|
305590
305744
|
if (typeof binTarget !== "string" || !/^[A-Za-z0-9_./-]+$/.test(binTarget) || isAbsolute7(binTarget) || binTarget.split("/").some((part) => !part || part === ".." || part === "."))
|
|
305591
305745
|
throw new Error("Omnius runtime manifest has no safe declared omnius executable.");
|
|
305592
|
-
for (const directory of binTarget.split("/").slice(0, -1).reduce((paths, part) => [...paths, join17(paths.at(-1) ??
|
|
305746
|
+
for (const directory of binTarget.split("/").slice(0, -1).reduce((paths, part) => [...paths, join17(paths.at(-1) ?? canonical2, part)], []))
|
|
305593
305747
|
assertOwnedDirectory(lstatSync3(directory), "Omnius executable directory");
|
|
305594
|
-
files[binTarget] ??= hashOwnedFile(join17(
|
|
305595
|
-
if (!readFileSync7(join17(
|
|
305748
|
+
files[binTarget] ??= hashOwnedFile(join17(canonical2, binTarget));
|
|
305749
|
+
if (!readFileSync7(join17(canonical2, "dist/update-worker.js"), "utf8").includes("omnius.update-worker-bootstrap.v2"))
|
|
305596
305750
|
throw new Error("Omnius runtime has no compatible update worker bootstrap.");
|
|
305597
|
-
if (hashOwnedFile(join17(
|
|
305751
|
+
if (hashOwnedFile(join17(canonical2, "package.json")) !== files["package.json"] || !sameIdentity(before, lstatSync3(canonical2)))
|
|
305598
305752
|
throw new Error("Omnius package changed during runtime verification.");
|
|
305599
305753
|
return {
|
|
305600
305754
|
modulesRoot: root,
|
|
@@ -305618,7 +305772,7 @@ async function preserveVerifiedNpmInstallation(snapshot, options) {
|
|
|
305618
305772
|
if (root !== options.lease.modulesRoot) throw new Error("Package preservation belongs to a different npm lease.");
|
|
305619
305773
|
const before = inspectNpmRuntimeInstallation(source);
|
|
305620
305774
|
if (before.device !== snapshot.device || before.inode !== snapshot.inode || before.packageHash !== snapshot.packageHash || JSON.stringify(before.files) !== JSON.stringify(snapshot.files)) throw new Error("Prior runtime changed before preservation.");
|
|
305621
|
-
const backupPath = join17(root, `.omnius-update-recovery-${
|
|
305775
|
+
const backupPath = join17(root, `.omnius-update-recovery-${randomUUID4()}`);
|
|
305622
305776
|
await mkdir(backupPath, { mode: 448 });
|
|
305623
305777
|
const metadata = await lstat2(backupPath);
|
|
305624
305778
|
const backup = { modulesRoot: root, retiredPath: retiredNpmPackagePath(source), backupPath, device: metadata.dev, inode: metadata.ino };
|
|
@@ -305655,7 +305809,7 @@ async function preserveVerifiedNpmInstallation(snapshot, options) {
|
|
|
305655
305809
|
return { backup, installation };
|
|
305656
305810
|
}
|
|
305657
305811
|
async function restoreVerifiedNpmInstallation(snapshot, options) {
|
|
305658
|
-
const root = resolve11(snapshot.modulesRoot),
|
|
305812
|
+
const root = resolve11(snapshot.modulesRoot), canonical2 = join17(root, "omnius");
|
|
305659
305813
|
const current = () => {
|
|
305660
305814
|
options.lease.assertOwnedForRecovery();
|
|
305661
305815
|
options.assertOwned();
|
|
@@ -305664,7 +305818,7 @@ async function restoreVerifiedNpmInstallation(snapshot, options) {
|
|
|
305664
305818
|
if (root !== options.lease.modulesRoot || !isAbsolute7(snapshot.modulesRoot)) throw new Error("Package recovery belongs to a different npm lease.");
|
|
305665
305819
|
const rootBefore = await lstat2(root);
|
|
305666
305820
|
assertOwnedDirectory(rootBefore, "global modules root");
|
|
305667
|
-
const validPath = (path3) => path3 ===
|
|
305821
|
+
const validPath = (path3) => path3 === canonical2 || path3 === retiredNpmPackagePath(canonical2) || options.backups?.some((backup) => backup.modulesRoot === root && backup.backupPath === path3 && dirname9(path3) === root && /^\.omnius-update-recovery-[a-f0-9-]{36}$/.test(basename8(path3)));
|
|
305668
305822
|
const matches = (path3) => {
|
|
305669
305823
|
if (!validPath(path3)) return false;
|
|
305670
305824
|
let metadata;
|
|
@@ -305684,29 +305838,29 @@ async function restoreVerifiedNpmInstallation(snapshot, options) {
|
|
|
305684
305838
|
assertOwnedDirectory(lstatSync3(directory), "prior Omnius executable directory");
|
|
305685
305839
|
return true;
|
|
305686
305840
|
};
|
|
305687
|
-
const source = [
|
|
305841
|
+
const source = [canonical2, retiredNpmPackagePath(canonical2), ...(options.backups ?? []).map((backup) => backup.backupPath)].find(matches);
|
|
305688
305842
|
if (!source) return null;
|
|
305689
305843
|
const recovery = {
|
|
305690
|
-
packagePath:
|
|
305844
|
+
packagePath: canonical2,
|
|
305691
305845
|
sourcePath: source,
|
|
305692
305846
|
version: snapshot.version,
|
|
305693
305847
|
packageHash: snapshot.packageHash,
|
|
305694
|
-
status: source ===
|
|
305848
|
+
status: source === canonical2 ? "unchanged" : "restored"
|
|
305695
305849
|
};
|
|
305696
|
-
if (source ===
|
|
305850
|
+
if (source === canonical2) return recovery;
|
|
305697
305851
|
let partial;
|
|
305698
305852
|
try {
|
|
305699
|
-
partial = await lstat2(
|
|
305853
|
+
partial = await lstat2(canonical2);
|
|
305700
305854
|
assertOwnedDirectory(partial, "failed Omnius replacement");
|
|
305701
305855
|
} catch (error) {
|
|
305702
305856
|
if (error.code !== "ENOENT") throw error;
|
|
305703
305857
|
}
|
|
305704
|
-
if (partial) recovery.partialPath = join17(root, `.omnius-update-recovery-${
|
|
305858
|
+
if (partial) recovery.partialPath = join17(root, `.omnius-update-recovery-${randomUUID4()}`);
|
|
305705
305859
|
await options.onPrepare?.({ ...recovery });
|
|
305706
305860
|
current();
|
|
305707
305861
|
if (!sameIdentity(rootBefore, await lstat2(root)) || !matches(source)) throw new Error("npm recovery identity changed before restoration.");
|
|
305708
305862
|
if (partial) {
|
|
305709
|
-
const now = await lstat2(
|
|
305863
|
+
const now = await lstat2(canonical2);
|
|
305710
305864
|
if (!sameIdentity(partial, now)) throw new Error("Failed Omnius replacement changed before preservation.");
|
|
305711
305865
|
try {
|
|
305712
305866
|
await lstat2(recovery.partialPath);
|
|
@@ -305715,18 +305869,18 @@ async function restoreVerifiedNpmInstallation(snapshot, options) {
|
|
|
305715
305869
|
if (error.code !== "ENOENT") throw error;
|
|
305716
305870
|
}
|
|
305717
305871
|
current();
|
|
305718
|
-
await rename(
|
|
305872
|
+
await rename(canonical2, recovery.partialPath);
|
|
305719
305873
|
}
|
|
305720
305874
|
current();
|
|
305721
305875
|
try {
|
|
305722
|
-
await lstat2(
|
|
305876
|
+
await lstat2(canonical2);
|
|
305723
305877
|
throw new Error("Canonical Omnius path changed before restoration.");
|
|
305724
305878
|
} catch (error) {
|
|
305725
305879
|
if (error.code !== "ENOENT") throw error;
|
|
305726
305880
|
}
|
|
305727
305881
|
if (!matches(source)) throw new Error("Prior Omnius runtime changed before restoration.");
|
|
305728
305882
|
current();
|
|
305729
|
-
await rename(source,
|
|
305883
|
+
await rename(source, canonical2);
|
|
305730
305884
|
if (process.platform !== "win32") {
|
|
305731
305885
|
const fd = openSync3(root, constants2.O_RDONLY);
|
|
305732
305886
|
try {
|
|
@@ -305736,8 +305890,8 @@ async function restoreVerifiedNpmInstallation(snapshot, options) {
|
|
|
305736
305890
|
}
|
|
305737
305891
|
}
|
|
305738
305892
|
current();
|
|
305739
|
-
if (!matches(
|
|
305740
|
-
if (process.platform !== "win32") await chmod(
|
|
305893
|
+
if (!matches(canonical2)) throw new Error("Restored Omnius runtime failed identity verification.");
|
|
305894
|
+
if (process.platform !== "win32") await chmod(canonical2, snapshot.mode);
|
|
305741
305895
|
return recovery;
|
|
305742
305896
|
}
|
|
305743
305897
|
async function removeVerifiedNpmRetirementBackup(backup) {
|
|
@@ -305888,7 +306042,7 @@ function guardOwnerIsProvablyDead(owner) {
|
|
|
305888
306042
|
function recoverInterruptedUpdateGuard(path3) {
|
|
305889
306043
|
const initial = interruptedGuardSnapshot(path3);
|
|
305890
306044
|
if (!initial || !guardOwnerIsProvablyDead(initial.owner)) return false;
|
|
305891
|
-
const recoveryPath = path3 + ".recovery", nonce =
|
|
306045
|
+
const recoveryPath = path3 + ".recovery", nonce = randomUUID5();
|
|
305892
306046
|
let fd;
|
|
305893
306047
|
try {
|
|
305894
306048
|
fd = openSync4(recoveryPath, constants3.O_WRONLY | constants3.O_CREAT | constants3.O_EXCL | constants3.O_NOFOLLOW, 384);
|
|
@@ -305921,7 +306075,7 @@ function recoverInterruptedUpdateGuard(path3) {
|
|
|
305921
306075
|
}
|
|
305922
306076
|
function withUpdateOwnership(paths, mutation) {
|
|
305923
306077
|
ensurePrivateDirectories(paths);
|
|
305924
|
-
const path3 = paths.lockFile + ".guard", nonce =
|
|
306078
|
+
const path3 = paths.lockFile + ".guard", nonce = randomUUID5();
|
|
305925
306079
|
let fd;
|
|
305926
306080
|
try {
|
|
305927
306081
|
fd = openSync4(path3, constants3.O_WRONLY | constants3.O_CREAT | constants3.O_EXCL | constants3.O_NOFOLLOW, 384);
|
|
@@ -306002,7 +306156,7 @@ function releaseMatchingUpdateLock(paths, operationId, pid) {
|
|
|
306002
306156
|
if (lock?.operation_id === operationId && (pid === void 0 || lock.pid === pid)) unlinkSync4(paths.lockFile);
|
|
306003
306157
|
}
|
|
306004
306158
|
function atomicPrivateJson(path3, value) {
|
|
306005
|
-
const temp = `${path3}.${process.pid}.${
|
|
306159
|
+
const temp = `${path3}.${process.pid}.${randomUUID5()}.tmp`;
|
|
306006
306160
|
try {
|
|
306007
306161
|
writeFileSync6(temp, `${JSON.stringify(value, null, 2)}
|
|
306008
306162
|
`, {
|
|
@@ -306207,7 +306361,7 @@ async function inspectGlobalOmniusInstall(expectedVersion, options = {}) {
|
|
|
306207
306361
|
throw new Error(`Global package verification failed: expected ${expectedVersion}, found ${installedVersion || "unknown"}`);
|
|
306208
306362
|
}
|
|
306209
306363
|
const runtime = inspectNpmRuntimeInstallation(dirname10(packageJsonPath));
|
|
306210
|
-
if (runtime.packageHash !==
|
|
306364
|
+
if (runtime.packageHash !== createHash5("sha256").update(packageJsonRaw).digest("hex"))
|
|
306211
306365
|
throw new Error("Global Omnius manifest changed during runtime verification");
|
|
306212
306366
|
const executablePath = globalExecutableCandidates(npmPrefix).find(existsSync8);
|
|
306213
306367
|
if (!executablePath) throw new Error(`Global Omnius executable not found under ${npmPrefix}`);
|
|
@@ -306226,7 +306380,7 @@ ${versionResult.stderr}`) ?? "";
|
|
|
306226
306380
|
executablePath,
|
|
306227
306381
|
installedVersion,
|
|
306228
306382
|
executableVersion,
|
|
306229
|
-
packageHash:
|
|
306383
|
+
packageHash: createHash5("sha256").update(packageJsonRaw).digest("hex")
|
|
306230
306384
|
};
|
|
306231
306385
|
}
|
|
306232
306386
|
function transitionOnce(current, patch, paths) {
|