@north-light/cli 0.3.641 → 0.3.643
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/clients/attach/viewer.js +504 -504
- package/dist/core/import/load/copy.d.ts +0 -1
- package/dist/core/import/load/copy.js +8 -8
- package/dist/core/runtime/warm-pool.d.ts +5 -1
- package/dist/core/runtime/warm-pool.js +1 -1
- package/dist/daemon/cron/lease-recovery.d.ts +1 -1
- package/dist/daemon/cron/passes.d.ts +2 -0
- package/dist/daemon/cron-run.d.ts +1 -1
- package/dist/daemon/cron-run.js +2 -2
- package/dist/daemon/crtrd.js +18 -18
- package/dist/daemon/reconcilers/broker-supervision.d.ts +2 -0
- package/dist/daemon/reconcilers/broker-supervision.js +1 -1
- package/dist/daemon/reconcilers/controller-death.d.ts +2 -0
- package/dist/daemon/reconcilers/controller-death.js +1 -1
- package/dist/daemon/reconcilers/cron-lane.d.ts +1 -0
- package/dist/daemon/reconcilers/cron-lane.js +1 -1
- package/dist/daemon/reconcilers/live-obligation.d.ts +3 -0
- package/dist/daemon/reconcilers/live-obligation.js +1 -1
- package/dist/daemon/reconcilers/node-deadline.d.ts +2 -1
- package/dist/daemon/reconcilers/node-deadline.js +1 -1
- package/dist/daemon/reconcilers/storage-maintenance.d.ts +2 -0
- package/dist/daemon/reconcilers/storage-maintenance.js +1 -1
- package/dist/daemon/reconcilers/structured-request-lane.d.ts +2 -1
- package/dist/daemon/reconcilers/structured-request-lane.js +1 -1
- package/package.json +2 -2
- package/packages/crouter-identity/package.json +1 -1
- package/runtime.lock.json +13 -13
|
@@ -9,6 +9,8 @@ export interface StorageMaintenanceContext {
|
|
|
9
9
|
lifecycle: DetachedWorkLifecycle;
|
|
10
10
|
/** A live engine handle is the sweep's proof that a node is NOT disposable. */
|
|
11
11
|
fleet: FleetRegistry;
|
|
12
|
+
/** Nodes of a committed, not yet `done` import run: no residue reap, retention prune or context strip. */
|
|
13
|
+
held: ReadonlySet<string>;
|
|
12
14
|
}
|
|
13
15
|
/** Recurring storage cleanup. Each sweep's throttle and overlap guard is a `reconciler_leases` row (`runThrottledLane`),
|
|
14
16
|
* so two reconciler processes never run one sweep at once and a restart does not repeat a sweep early. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var S=Object.defineProperty;var f=(
|
|
1
|
+
var S=Object.defineProperty;var f=(_,e)=>S(_,"name",{value:e,configurable:!0});import{rm as R}from"node:fs/promises";import{closeFocusRow as I,getFocusById as A,listFocuses as N,listNodes as T}from"../../core/canvas/index.js";import{pruneExpiredIdempotencyKeys as P}from"../../core/runs/operations.js";import{getNode as C,lastActivityMs as p,listTerminalPlacementResidue as D,pruneExpiredCreateRequests as F,pruneNodes as x}from"../../core/canvas/canvas.js";import{lastContextStripMs as M,stripContextDir as L}from"../../core/canvas/context-strip.js";import{isAppRun as W}from"../../core/canvas/app-run.js";import{isSafeNodeId as d}from"../../core/canvas/paths.js";import{emitEvent as a}from"../../core/events/emit.js";import{operationIdContext as s}from"../../core/events/operation-id.js";import{listLivePanesAsync as b,tearDownNode as G}from"../../core/runtime/placement.js";import{reapStaleSpares as V}from"../../core/runtime/warm-pool.js";import{GroveInstanceSweepReconciler as k}from"./grove-instance-sweep.js";import{ManagedWorktreeSweepReconciler as O}from"./managed-worktree-sweep.js";import{compactRunEvents as q}from"../../core/runs/events.js";import{archiveExpiredRunEvents as U}from"../../core/events/run-event-chunks.js";import{blobStore as H}from"../../core/blobs/index.js";import{runThrottledLane as c}from"./throttled-lane.js";import{openDb as w}from"../../core/canvas/db.js";import{touchMachineEnvironment as Y}from"../../core/environments.js";import{retentionHold as y}from"./live-obligation.js";import{pruneMemoryReads as z}from"../../core/canvas/memory-reads.js";import{existsSync as K}from"node:fs";import{launcherRequest as $}from"../../launcher/client.js";import{LAUNCHER_SOCKET as B}from"../../launcher/spec.js";import{cachePassDue as Q}from"../../launcher/limits/policy.js";const X=10*6e4,l=60*1e3,g=60*1e3,h=5*6e4,Z=2,j=1440*6e4,J=2e3,ee=6e4;class Te{static{f(this,"StorageMaintenanceReconciler")}focusGcInFlight=!1;lastCachePassAt=null;cachePassInFlight=!1;worktreeSweep=new O;groveInstanceSweep=new k;async run(e,r){await this.reapDeadResidue(e,r.held),this.scheduleFocusGc(r),await this.gcWarmPool(e),await this.touchEnvironment(e),await this.gcCreateRequests(e),await this.gcViewerAttachments(e);try{await c("run-event-maintenance","",e,J,ee,async t=>{await U(await H(),e);const n=await q(e,t.state===null?0:Number(t.state));await t.save(String(n.cursor))})}catch(t){console.warn(`run event maintenance failed: ${String(t)}`)}await c("memory-read-prune","",e,60*6e4,10*6e4,async()=>{try{await z(e)}catch(t){console.warn(`memory-read log prune failed: ${String(t)}`)}}),await c("storage-analyze","",e,1440*6e4,10*6e4,async()=>{await(await w()).exec("ANALYZE")}),await this.sweepRetention(e,r),this.scheduleCachePass(e,r),this.scheduleContextStrip(e,r),this.worktreeSweep.run(e,r),this.groveInstanceSweep.run(e,r)}scheduleCachePass(e,r){this.cachePassInFlight||!Q(this.lastCachePassAt,e)||process.platform!=="linux"||!K(B)||r.lifecycle.acceptsDetachedWork()&&(this.lastCachePassAt=e,this.cachePassInFlight=!0,r.lifecycle.registerDetached($({operation:"cache.purge"}).then(()=>{}).catch(t=>{s.fresh(()=>{a({level:"warn",event:"app.cache.pass_failed",error:t})})}).then(()=>{this.cachePassInFlight=!1})))}msSinceTerminalActivity(e,r){const t=p(e);return t===0?Number.POSITIVE_INFINITY:r-t}async sweepRetention(e,r){r.lifecycle.acceptsDetachedWork()&&await c("retention-sweep","",e,h,h,()=>s.fresh(async()=>{try{const t=await x({ttlDays:Z,held:await y(r.fleet),removeDirs:f(n=>{r.lifecycle.registerDetached(Promise.all(n.map(o=>R(o,{recursive:!0,force:!0}))).then(()=>{}).catch(o=>{s.fresh(()=>{a({level:"error",event:"canvas.retention.failed",error:o})})}))},"removeDirs")});t.pruned.length>0&&a({level:"info",event:"canvas.retention.pruned",outcome:"succeeded",fields:{pruned_count:t.pruned.length}})}catch(t){a({level:"error",event:"canvas.retention.failed",error:t})}}))}scheduleContextStrip(e,r){r.lifecycle.acceptsDetachedWork()&&r.lifecycle.registerDetached(c("context-strip","",e,h,10*6e4,()=>this.stripFinishedContexts(e,r)).then(()=>{},t=>{a({level:"error",event:"canvas.context_strip.failed",error:t})}))}async stripFinishedContexts(e,r){const t=await y(r.fleet),n=f(async i=>i!==null&&["done","canceled","dead"].includes(i.status)&&(i.pi_pid??null)===null&&(i.frozen_at??null)===null&&!W(i)&&p(i)<e-j&&!await t(i.node_id),"eligible");let o=0,m=0;try{for(const i of await T({status:["done","canceled","dead"]})){if(!d(i.node_id)||!await n(i))continue;const v=await M(i.node_id);if(v!==null&&v>=p(i)||!await n(await C(i.node_id)))continue;let u;try{u=await L(i.node_id)}catch(E){s.fresh(()=>{a({level:"warn",event:"canvas.context_strip.node_failed",error:E,fields:{node_id:i.node_id}})});continue}u.removed.length>0&&(o+=1,m+=u.bytes)}}catch(i){s.fresh(()=>{a({level:"error",event:"canvas.context_strip.failed",error:i})})}o>0&&s.fresh(()=>{a({level:"info",event:"canvas.context_strip.completed",outcome:"succeeded",fields:{node_count:o,bytes:m}})})}async reapDeadResidue(e,r){let t;try{t=await D()}catch(n){s.fresh(()=>{a({level:"error",event:"residue.reap_scan.failed",error:n})});return}for(const n of t)if(!r.has(n.node_id)){try{if(this.msSinceTerminalActivity(n,e)<X)continue}catch(o){s.fresh(()=>{a({level:"error",event:"residue.reap.failed",...d(n.node_id)?{node_id:n.node_id}:{},error:o,fields:{...d(n.node_id)?{}:{affected_node_id:n.node_id},pane:n.pane,window:n.window,tmux_session:n.tmux_session}})});continue}await s.fresh(async()=>{try{a({level:"info",event:"residue.reaped",...d(n.node_id)?{node_id:n.node_id}:{},fields:{...d(n.node_id)?{}:{affected_node_id:n.node_id},pane:n.pane,window:n.window,tmux_session:n.tmux_session}}),await G(n.node_id)}catch(o){a({level:"error",event:"residue.reap.failed",...d(n.node_id)?{node_id:n.node_id}:{},error:o,fields:{...d(n.node_id)?{}:{affected_node_id:n.node_id},pane:n.pane,window:n.window,tmux_session:n.tmux_session}})}})}}scheduleFocusGc(e){if(this.focusGcInFlight||!e.lifecycle.acceptsDetachedWork())return;this.focusGcInFlight=!0;const r=this.gcStaleFocuses().finally(()=>{this.focusGcInFlight=!1});e.lifecycle.registerDetached(r)}async gcStaleFocuses(){let e;try{e=await N()}catch(t){s.fresh(()=>{a({level:"error",event:"focus.gc.failed",error:t})});return}if(e.length===0)return;let r;try{r=await b()}catch(t){s.fresh(()=>{a({level:"error",event:"focus.gc.failed",error:t})});return}if(r!==null)for(const t of e){if(t.pane===null||r.has(t.pane))continue;if(!await s.fresh(async()=>{try{return(await A(t.focus_id))?.pane!==t.pane||(a({level:"info",event:"focus.gc.removed",...d(t.node_id)?{node_id:t.node_id}:{},fields:{focus_id:t.focus_id,focus_node_id:t.node_id,pane:t.pane}}),await I(t.focus_id)),!0}catch(o){return a({level:"error",event:"focus.gc.failed",error:o}),!1}}))return}}async gcCreateRequests(e){await c("create-request-gc","",e,g,g,()=>s.fresh(async()=>{const r=await F(e),t=await P(e);t>0&&a({level:"info",event:"canvas.idempotency_keys.reaped",outcome:"succeeded",fields:{reaped_count:t}}),r>0&&a({level:"info",event:"canvas.create_requests.reaped",outcome:"succeeded",fields:{reaped_count:r}})}))}async gcViewerAttachments(e){await c("viewer-attachment-gc","",e,l,l,()=>s.fresh(async()=>{const r=Number((await(await w()).prepare("DELETE FROM viewer_attachments WHERE expires_at <= ?").run(new Date(e).toISOString())).changes);r>0&&a({level:"info",event:"viewer_attachments.reaped",outcome:"succeeded",fields:{reaped_count:r}})}))}async touchEnvironment(e){await c("environment-touch","",e,l,l,()=>s.fresh(async()=>{try{await Y(new Date(e).toISOString())}catch(r){a({level:"warn",event:"environment.touch.failed",error:r})}}))}async gcWarmPool(e){await c("warm-pool-gc","",e,l,l,()=>s.fresh(async()=>{const r=await V();r.length>0&&a({level:"info",event:"warm_pool.spares_reaped",outcome:"succeeded",fields:{reaped_count:r.length}})}))}}export{j as CONTEXT_STRIP_GRACE_MS,X as DEAD_REAP_GRACE_MS,h as RETENTION_SWEEP_INTERVAL_MS,Z as RETENTION_TTL_DAYS,Te as StorageMaintenanceReconciler};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/** Settles rows whose waiter disappeared and retries every incomplete durable effect. */
|
|
2
2
|
export declare class StructuredRequestReconciler {
|
|
3
|
-
run
|
|
3
|
+
/** `held`: nodes of a committed, not yet `done` import run; a request of theirs stays as imported. */
|
|
4
|
+
run(now: number, held: ReadonlySet<string>): Promise<void>;
|
|
4
5
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var _=Object.defineProperty;var s=(t,r)=>_(t,"name",{value:r,configurable:!0});import{withCanvasWrite as w}from"../../core/canvas/db.js";import{incompleteStructuredRequestEffects as m,pendingStructuredRequestsPast as p,settleStructuredRequestIn as q}from"../../core/canvas/structured-requests.js";import{emitEvent as c}from"../../core/events/emit.js";import{applySettlementEffects as u}from"../structured-requests/effects.js";import{withRowClaim as a}from"./row-claim.js";const d=6e4,l=s(t=>{c({level:"error",event:"structured_request.reconcile_failed",error:t})},"reportFailure");class E{static{s(this,"StructuredRequestReconciler")}async run(r,n){try{for(const e of await p(r))e.node_id!==null&&n.has(e.node_id)||a("structured_requests",e.request_id,d,async i=>{const o=await w(async f=>(await i.assertOwned(),await q(f,e.request_id,{intended:"expired",now:r})));o.changed&&o.row!==null&&await u(o.row,i)}).catch(l);for(const e of await m())e.node_id!==null&&n.has(e.node_id)||a("structured_requests",e.request_id,d,async i=>{await u(e,i)}).catch(l)}catch(e){c({level:"error",event:"structured_request.reconcile_failed",error:e})}}}export{E as StructuredRequestReconciler};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@north-light/cli",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.643",
|
|
4
4
|
"description": "crtr — agent runtime with memory, plugins, and marketplaces",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -145,7 +145,7 @@
|
|
|
145
145
|
},
|
|
146
146
|
"license": "UNLICENSED",
|
|
147
147
|
"dependencies": {
|
|
148
|
-
"@north-light/identity": "0.3.
|
|
148
|
+
"@north-light/identity": "0.3.643",
|
|
149
149
|
"@earendil-works/chord": "1.1.0",
|
|
150
150
|
"@earendil-works/pi-agent-core": "1.1.0",
|
|
151
151
|
"@earendil-works/pi-ai": "1.1.0",
|
package/runtime.lock.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@north-light/cli",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.643",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@north-light/cli",
|
|
9
|
-
"version": "0.3.
|
|
9
|
+
"version": "0.3.643",
|
|
10
10
|
"hasInstallScript": true,
|
|
11
11
|
"license": "UNLICENSED",
|
|
12
12
|
"workspaces": [
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"@milkdown/preset-gfm": "^7.22.3",
|
|
29
29
|
"@milkdown/prose": "^7.22.3",
|
|
30
30
|
"@milkdown/utils": "^7.22.3",
|
|
31
|
-
"@north-light/identity": "0.3.
|
|
31
|
+
"@north-light/identity": "0.3.643",
|
|
32
32
|
"cron-parser": "^5.6.0",
|
|
33
33
|
"esbuild": "^0.27.7",
|
|
34
34
|
"jose": "^6.2.12",
|
|
@@ -11956,17 +11956,17 @@
|
|
|
11956
11956
|
},
|
|
11957
11957
|
"packages/crouter-api": {
|
|
11958
11958
|
"name": "@north-light/api",
|
|
11959
|
-
"version": "0.3.
|
|
11959
|
+
"version": "0.3.643",
|
|
11960
11960
|
"license": "UNLICENSED"
|
|
11961
11961
|
},
|
|
11962
11962
|
"packages/crouter-env-docker": {
|
|
11963
11963
|
"name": "@north-light/env-docker",
|
|
11964
|
-
"version": "0.3.
|
|
11964
|
+
"version": "0.3.643",
|
|
11965
11965
|
"license": "UNLICENSED"
|
|
11966
11966
|
},
|
|
11967
11967
|
"packages/crouter-identity": {
|
|
11968
11968
|
"name": "@north-light/identity",
|
|
11969
|
-
"version": "0.3.
|
|
11969
|
+
"version": "0.3.643",
|
|
11970
11970
|
"license": "UNLICENSED",
|
|
11971
11971
|
"dependencies": {
|
|
11972
11972
|
"jose": "^6.2.1"
|
|
@@ -11974,21 +11974,21 @@
|
|
|
11974
11974
|
},
|
|
11975
11975
|
"packages/crouter-plugin": {
|
|
11976
11976
|
"name": "@north-light/plugin",
|
|
11977
|
-
"version": "0.3.
|
|
11977
|
+
"version": "0.3.643",
|
|
11978
11978
|
"license": "UNLICENSED",
|
|
11979
11979
|
"dependencies": {
|
|
11980
|
-
"@north-light/api": "0.3.
|
|
11981
|
-
"@north-light/identity": "0.3.
|
|
11980
|
+
"@north-light/api": "0.3.643",
|
|
11981
|
+
"@north-light/identity": "0.3.643"
|
|
11982
11982
|
}
|
|
11983
11983
|
},
|
|
11984
11984
|
"packages/crouter-sdk": {
|
|
11985
11985
|
"name": "@north-light/sdk",
|
|
11986
|
-
"version": "0.3.
|
|
11986
|
+
"version": "0.3.643",
|
|
11987
11987
|
"license": "UNLICENSED",
|
|
11988
11988
|
"dependencies": {
|
|
11989
|
-
"@north-light/api": "0.3.
|
|
11990
|
-
"@north-light/identity": "0.3.
|
|
11991
|
-
"@north-light/plugin": "0.3.
|
|
11989
|
+
"@north-light/api": "0.3.643",
|
|
11990
|
+
"@north-light/identity": "0.3.643",
|
|
11991
|
+
"@north-light/plugin": "0.3.643",
|
|
11992
11992
|
"jose": "^6.2.1"
|
|
11993
11993
|
},
|
|
11994
11994
|
"bin": {
|