@nowcrew/daemon 0.6.77-beta.7 → 0.6.77-beta.9
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/README.md +27 -0
- package/dist/automatic-daemon-installer.js +15 -6
- package/dist/automatic-install-target.js +34 -9
- package/dist/computer-cli.js +39 -11
- package/dist/computer-profile.js +15 -2
- package/dist/daemon-installation-lease.js +7 -4
- package/dist/daemon-local-home.js +108 -0
- package/dist/daemon-migration-controller.js +15 -4
- package/dist/daemon-update-eligibility.js +15 -7
- package/dist/host-execution-coordinator.js +4 -3
- package/dist/main.js +13 -2
- package/dist/managed-service-diagnostics.js +1 -0
- package/dist/managed-service-registry.js +12 -7
- package/dist/managed-service-startup.js +4 -1
- package/dist/serve.js +5 -2
- package/dist/slog.js +14 -1
- package/dist/storage-control.js +12 -1
- package/dist/storage-identity.js +15 -1
- package/dist/storage-migration-controller.js +25 -4
- package/dist/storage-ownership.js +55 -0
- package/dist/storage-runtime-controller.js +29 -7
- package/dist/storage-runtime-readiness.js +26 -4
- package/dist/storage-runtime.js +18 -2
- package/dist/storage-status-delivery.js +4 -0
- package/dist/storage-status-replay.js +16 -1
- package/dist/storage-worker-executor.js +1 -0
- package/dist/storage-worker-operation.js +4 -0
- package/package.json +9 -10
|
@@ -18,6 +18,8 @@ const DeliveredFrameSchema = z.object({
|
|
|
18
18
|
environment: z.string().regex(/^[a-z0-9][a-z0-9_-]{0,31}$/u),
|
|
19
19
|
workspaceId: z.string().uuid(),
|
|
20
20
|
profile: z.string().regex(/^[a-z0-9][a-z0-9_-]{0,47}$/u),
|
|
21
|
+
ownerEpoch: z.number().int().positive().safe().optional(),
|
|
22
|
+
ownershipClaimFingerprint: z.string().regex(/^sha256:[0-9a-f]{64}$/u).optional(),
|
|
21
23
|
sourceStorageFingerprint: z.string().optional(),
|
|
22
24
|
targetStorageFingerprint: z.string().optional(),
|
|
23
25
|
manifestDigest: z.string().optional(),
|
|
@@ -45,6 +47,8 @@ export function storageStatusEventId(frame) {
|
|
|
45
47
|
frame.environment,
|
|
46
48
|
frame.workspaceId,
|
|
47
49
|
frame.profile,
|
|
50
|
+
frame.ownerEpoch ?? null,
|
|
51
|
+
frame.ownershipClaimFingerprint ?? null,
|
|
48
52
|
frame.sourceStorageFingerprint ?? null,
|
|
49
53
|
frame.targetStorageFingerprint ?? null,
|
|
50
54
|
frame.manifestDigest ?? null,
|
|
@@ -35,7 +35,10 @@ export function storageMigrationStatusReplay(receipt, expected) {
|
|
|
35
35
|
if (expected !== undefined && (receipt.migrationId !== expected.migrationId
|
|
36
36
|
|| receipt.environment !== expected.environment
|
|
37
37
|
|| receipt.workspaceId !== expected.workspaceId
|
|
38
|
-
|| receipt.profile !== expected.profile
|
|
38
|
+
|| receipt.profile !== expected.profile
|
|
39
|
+
|| (expected.ownerEpoch !== undefined && receipt.ownerEpoch !== expected.ownerEpoch)
|
|
40
|
+
|| (expected.ownershipClaimFingerprint !== undefined
|
|
41
|
+
&& receipt.ownershipClaimFingerprint !== expected.ownershipClaimFingerprint))) {
|
|
39
42
|
throw new Error("storage migration receipt identity mismatch");
|
|
40
43
|
}
|
|
41
44
|
return Object.freeze(storageMigrationReplayStatuses(receipt).map((status) => Object.freeze({
|
|
@@ -45,6 +48,10 @@ export function storageMigrationStatusReplay(receipt, expected) {
|
|
|
45
48
|
environment: receipt.environment,
|
|
46
49
|
workspaceId: receipt.workspaceId,
|
|
47
50
|
profile: receipt.profile,
|
|
51
|
+
...(receipt.ownerEpoch === undefined ? {} : { ownerEpoch: receipt.ownerEpoch }),
|
|
52
|
+
...(receipt.ownershipClaimFingerprint === undefined ? {} : {
|
|
53
|
+
ownershipClaimFingerprint: receipt.ownershipClaimFingerprint,
|
|
54
|
+
}),
|
|
48
55
|
...(status === "verified" ? { finalManifestDigest: receipt.manifestDigest } : {}),
|
|
49
56
|
...(status === "failed"
|
|
50
57
|
? {
|
|
@@ -98,6 +105,10 @@ export async function monitorStorageMigrationStatus(input, send, injected = {})
|
|
|
98
105
|
environment: input.environment,
|
|
99
106
|
workspaceId: input.workspaceId,
|
|
100
107
|
profile: input.profile,
|
|
108
|
+
...(input.ownerEpoch === undefined ? {} : { ownerEpoch: input.ownerEpoch }),
|
|
109
|
+
...(input.ownershipClaimFingerprint === undefined ? {} : {
|
|
110
|
+
ownershipClaimFingerprint: input.ownershipClaimFingerprint,
|
|
111
|
+
}),
|
|
101
112
|
errorCode: workerFailure.errorCode,
|
|
102
113
|
errorMessage: workerFailure.errorMessage,
|
|
103
114
|
...(receipt?.sourceStopAttempted === false || receipt === null ? { reopenAdmission: true } : {}),
|
|
@@ -114,6 +125,10 @@ export async function monitorStorageMigrationStatus(input, send, injected = {})
|
|
|
114
125
|
environment: input.environment,
|
|
115
126
|
workspaceId: input.workspaceId,
|
|
116
127
|
profile: input.profile,
|
|
128
|
+
...(input.ownerEpoch === undefined ? {} : { ownerEpoch: input.ownerEpoch }),
|
|
129
|
+
...(input.ownershipClaimFingerprint === undefined ? {} : {
|
|
130
|
+
ownershipClaimFingerprint: input.ownershipClaimFingerprint,
|
|
131
|
+
}),
|
|
117
132
|
errorCode: "worker_heartbeat_stale_recovery_required",
|
|
118
133
|
errorMessage: "storage migration worker heartbeat expired; explicit recovery is required",
|
|
119
134
|
...(receipt?.sourceStopAttempted === false || receipt === null ? { reopenAdmission: true } : {}),
|
|
@@ -367,6 +367,7 @@ export async function executeStorageMigrationWorker(handoffPath, injected = {})
|
|
|
367
367
|
targetWorkspaceRoot: operation.migration.targetWorkspaceRoot,
|
|
368
368
|
backupsRoot: operation.migration.backupsRoot,
|
|
369
369
|
backupArtifacts: operation.migration.backupArtifacts,
|
|
370
|
+
...(operation.migration.ownership === undefined ? {} : { ownership: operation.migration.ownership }),
|
|
370
371
|
acceptedWarnings: operation.migration.acceptedWarnings,
|
|
371
372
|
onStatus: () => assertHeartbeatHealthy(),
|
|
372
373
|
assertHealthy: assertHeartbeatHealthy,
|
|
@@ -118,6 +118,10 @@ const OperationSchema = z.object({
|
|
|
118
118
|
name: z.string().regex(/^[a-z0-9][a-z0-9_.-]{0,127}$/u),
|
|
119
119
|
path: AbsolutePathSchema,
|
|
120
120
|
}).strict()).max(32),
|
|
121
|
+
ownership: z.object({
|
|
122
|
+
ownerEpoch: z.number().int().positive().safe(),
|
|
123
|
+
ownershipClaimFingerprint: z.string().regex(/^sha256:[0-9a-f]{64}$/u),
|
|
124
|
+
}).strict().optional(),
|
|
121
125
|
acceptedWarnings: z.array(StorageMigrationWarningCodeSchema)
|
|
122
126
|
.max(StorageMigrationWarningCodeSchema.options.length),
|
|
123
127
|
}).strict(),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nowcrew/daemon",
|
|
3
|
-
"version": "0.6.77-beta.
|
|
3
|
+
"version": "0.6.77-beta.9",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "crew daemon — 运行在用户机器:拉起/管理 agent 进程,注入 crew CLI,归一化 runtime 事件",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -16,14 +16,6 @@
|
|
|
16
16
|
"publishConfig": {
|
|
17
17
|
"access": "public"
|
|
18
18
|
},
|
|
19
|
-
"scripts": {
|
|
20
|
-
"daemon": "pnpm --filter @nowcrew/cli build && tsx src/main.ts",
|
|
21
|
-
"build": "tsc -p tsconfig.json",
|
|
22
|
-
"codex-home:migrate": "tsx src/runtimes/codex-home-migration-cli.ts",
|
|
23
|
-
"prepublishOnly": "pnpm build && node ../scripts/daemon-release-artifact.mjs --strict-registry",
|
|
24
|
-
"test": "vitest run",
|
|
25
|
-
"typecheck": "tsc --noEmit"
|
|
26
|
-
},
|
|
27
19
|
"dependencies": {
|
|
28
20
|
"@agentclientprotocol/sdk": "1.2.1",
|
|
29
21
|
"@nowcrew/cli": "0.4.13",
|
|
@@ -44,5 +36,12 @@
|
|
|
44
36
|
"tsx": "^4.19.0",
|
|
45
37
|
"typescript": "^5.6.0",
|
|
46
38
|
"vitest": "^2.1.0"
|
|
39
|
+
},
|
|
40
|
+
"scripts": {
|
|
41
|
+
"daemon": "pnpm --filter @nowcrew/cli build && tsx src/main.ts",
|
|
42
|
+
"build": "tsc -p tsconfig.json",
|
|
43
|
+
"codex-home:migrate": "tsx src/runtimes/codex-home-migration-cli.ts",
|
|
44
|
+
"test": "vitest run",
|
|
45
|
+
"typecheck": "tsc --noEmit"
|
|
47
46
|
}
|
|
48
|
-
}
|
|
47
|
+
}
|