@plurnk/plurnk-service 1.0.4 → 1.0.6
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/.env.defaults +55 -31
- package/INSTALL.md +3 -3
- package/README.md +4 -4
- package/SPEC.md +205 -193
- package/dist/Paths.js +1 -1
- package/dist/Paths.js.map +1 -1
- package/dist/core/ChannelWrite.d.ts +18 -18
- package/dist/core/ChannelWrite.d.ts.map +1 -1
- package/dist/core/ChannelWrite.js +17 -17
- package/dist/core/ChannelWrite.js.map +1 -1
- package/dist/core/ChannelWrite.sql +11 -11
- package/dist/core/Dispatcher.d.ts +11 -16
- package/dist/core/Dispatcher.d.ts.map +1 -1
- package/dist/core/Dispatcher.js +122 -125
- package/dist/core/Dispatcher.js.map +1 -1
- package/dist/core/Engine.d.ts +20 -23
- package/dist/core/Engine.d.ts.map +1 -1
- package/dist/core/Engine.js +213 -210
- package/dist/core/Engine.js.map +1 -1
- package/dist/core/Engine.sql +108 -130
- package/dist/core/PacketBuilder.d.ts +10 -11
- package/dist/core/PacketBuilder.d.ts.map +1 -1
- package/dist/core/PacketBuilder.js +204 -128
- package/dist/core/PacketBuilder.js.map +1 -1
- package/dist/core/ProposalLifecycle.d.ts +8 -8
- package/dist/core/ProposalLifecycle.d.ts.map +1 -1
- package/dist/core/ProposalLifecycle.js +10 -10
- package/dist/core/ProposalLifecycle.js.map +1 -1
- package/dist/core/ProviderInstantiate.d.ts +1 -0
- package/dist/core/ProviderInstantiate.d.ts.map +1 -1
- package/dist/core/ProviderInstantiate.js +9 -3
- package/dist/core/ProviderInstantiate.js.map +1 -1
- package/dist/core/SchemeRegistry.d.ts +4 -1
- package/dist/core/SchemeRegistry.d.ts.map +1 -1
- package/dist/core/SchemeRegistry.js +18 -9
- package/dist/core/SchemeRegistry.js.map +1 -1
- package/dist/core/TelemetryChannel.d.ts +5 -5
- package/dist/core/TelemetryChannel.d.ts.map +1 -1
- package/dist/core/TelemetryChannel.js +9 -9
- package/dist/core/TelemetryChannel.js.map +1 -1
- package/dist/core/caps/CapsResolve.js +2 -2
- package/dist/core/caps/CapsResolve.js.map +1 -1
- package/dist/core/caps/DbNotifyCaps.js +2 -2
- package/dist/core/caps/DbNotifyCaps.js.map +1 -1
- package/dist/core/caps/DbSubscriptionCaps.js +7 -7
- package/dist/core/caps/DbSubscriptionCaps.js.map +1 -1
- package/dist/core/caps/SchemeCtxImpl.d.ts +2 -2
- package/dist/core/caps/SchemeCtxImpl.d.ts.map +1 -1
- package/dist/core/caps/SchemeCtxImpl.js +4 -4
- package/dist/core/caps/SchemeCtxImpl.js.map +1 -1
- package/dist/core/content-hash.d.ts +2 -0
- package/dist/core/content-hash.d.ts.map +1 -0
- package/dist/core/content-hash.js +6 -0
- package/dist/core/content-hash.js.map +1 -0
- package/dist/core/fork.d.ts +1 -1
- package/dist/core/fork.d.ts.map +1 -1
- package/dist/core/fork.js +31 -26
- package/dist/core/fork.js.map +1 -1
- package/dist/core/fork.sql +41 -32
- package/dist/core/git-env.d.ts.map +1 -1
- package/dist/core/git-env.js +23 -7
- package/dist/core/git-env.js.map +1 -1
- package/dist/core/git-iso.d.ts +9 -0
- package/dist/core/git-iso.d.ts.map +1 -0
- package/dist/core/git-iso.js +227 -0
- package/dist/core/git-iso.js.map +1 -0
- package/dist/core/git-membership.d.ts +2 -2
- package/dist/core/git-membership.d.ts.map +1 -1
- package/dist/core/git-membership.js +70 -50
- package/dist/core/git-membership.js.map +1 -1
- package/dist/core/git-state.d.ts +1 -1
- package/dist/core/git-state.d.ts.map +1 -1
- package/dist/core/git-state.js +21 -11
- package/dist/core/git-state.js.map +1 -1
- package/dist/core/packet-wire.d.ts.map +1 -1
- package/dist/core/packet-wire.js +81 -22
- package/dist/core/packet-wire.js.map +1 -1
- package/dist/core/plurnk-uri.d.ts +2 -2
- package/dist/core/plurnk-uri.d.ts.map +1 -1
- package/dist/core/plurnk-uri.js +19 -12
- package/dist/core/plurnk-uri.js.map +1 -1
- package/dist/core/run-ops.sql +26 -26
- package/dist/core/scheme-types.d.ts +6 -11
- package/dist/core/scheme-types.d.ts.map +1 -1
- package/dist/core/search-gate.js +0 -0
- package/dist/core/search-gate.js.map +1 -1
- package/dist/core/token-ruler.d.ts +2 -0
- package/dist/core/token-ruler.d.ts.map +1 -0
- package/dist/core/token-ruler.js +18 -0
- package/dist/core/token-ruler.js.map +1 -0
- package/dist/core/worker-cap.d.ts +8 -0
- package/dist/core/worker-cap.d.ts.map +1 -0
- package/dist/core/worker-cap.js +20 -0
- package/dist/core/worker-cap.js.map +1 -0
- package/dist/core/{session-settings.d.ts → workspace-settings.d.ts} +5 -5
- package/dist/core/workspace-settings.d.ts.map +1 -0
- package/dist/core/{session-settings.js → workspace-settings.js} +13 -13
- package/dist/core/workspace-settings.js.map +1 -0
- package/dist/digest/Digest.d.ts +3 -3
- package/dist/digest/Digest.d.ts.map +1 -1
- package/dist/digest/Digest.js +79 -73
- package/dist/digest/Digest.js.map +1 -1
- package/dist/digest/digest.sql +18 -18
- package/dist/schemes/Exec.d.ts +9 -2
- package/dist/schemes/Exec.d.ts.map +1 -1
- package/dist/schemes/Exec.js +121 -68
- package/dist/schemes/Exec.js.map +1 -1
- package/dist/schemes/ExecOutputScheme.js +3 -3
- package/dist/schemes/ExecOutputScheme.js.map +1 -1
- package/dist/schemes/File.js +23 -23
- package/dist/schemes/File.js.map +1 -1
- package/dist/schemes/Known.js +5 -5
- package/dist/schemes/Known.js.map +1 -1
- package/dist/schemes/Log.d.ts.map +1 -1
- package/dist/schemes/Log.js +63 -14
- package/dist/schemes/Log.js.map +1 -1
- package/dist/schemes/Log.sql +49 -8
- package/dist/schemes/Plurnk.js +5 -5
- package/dist/schemes/Plurnk.js.map +1 -1
- package/dist/schemes/Skill.js +5 -5
- package/dist/schemes/Skill.js.map +1 -1
- package/dist/schemes/Unknown.js +5 -5
- package/dist/schemes/Unknown.js.map +1 -1
- package/dist/schemes/{Run.d.ts → Worker.d.ts} +2 -2
- package/dist/schemes/Worker.d.ts.map +1 -0
- package/dist/schemes/{Run.js → Worker.js} +67 -67
- package/dist/schemes/Worker.js.map +1 -0
- package/dist/schemes/_entry-crud.js +11 -11
- package/dist/schemes/_entry-crud.js.map +1 -1
- package/dist/schemes/_entry-crud.sql +29 -29
- package/dist/schemes/_entry-find.d.ts +2 -1
- package/dist/schemes/_entry-find.d.ts.map +1 -1
- package/dist/schemes/_entry-find.js +31 -19
- package/dist/schemes/_entry-find.js.map +1 -1
- package/dist/schemes/_entry-find.sql +9 -9
- package/dist/schemes/_entry-graph.d.ts +2 -2
- package/dist/schemes/_entry-graph.d.ts.map +1 -1
- package/dist/schemes/_entry-graph.js +18 -18
- package/dist/schemes/_entry-graph.js.map +1 -1
- package/dist/schemes/_entry-graph.sql +8 -8
- package/dist/schemes/_entry-manifest.d.ts +1 -1
- package/dist/schemes/_entry-manifest.d.ts.map +1 -1
- package/dist/schemes/_entry-manifest.js +74 -50
- package/dist/schemes/_entry-manifest.js.map +1 -1
- package/dist/schemes/_entry-ops.d.ts +4 -4
- package/dist/schemes/_entry-ops.d.ts.map +1 -1
- package/dist/schemes/_entry-ops.js +25 -25
- package/dist/schemes/_entry-ops.js.map +1 -1
- package/dist/schemes/_entry-ops.sql +9 -9
- package/dist/schemes/_entry-semantic.d.ts +2 -1
- package/dist/schemes/_entry-semantic.d.ts.map +1 -1
- package/dist/schemes/_entry-semantic.js +23 -4
- package/dist/schemes/_entry-semantic.js.map +1 -1
- package/dist/schemes/_entry-semantic.sql +18 -4
- package/dist/schemes/_entry-send.d.ts +1 -1
- package/dist/schemes/_entry-send.d.ts.map +1 -1
- package/dist/schemes/_entry-send.js +6 -6
- package/dist/schemes/_entry-send.js.map +1 -1
- package/dist/schemes/exec-abort.js +1 -1
- package/dist/schemes/exec-abort.js.map +1 -1
- package/dist/server/Daemon.d.ts +50 -48
- package/dist/server/Daemon.d.ts.map +1 -1
- package/dist/server/Daemon.js +307 -297
- package/dist/server/Daemon.js.map +1 -1
- package/dist/server/client-input.js +20 -20
- package/dist/server/client-input.js.map +1 -1
- package/dist/server/dispatch-as-plurnk.d.ts +1 -1
- package/dist/server/dispatch-as-plurnk.d.ts.map +1 -1
- package/dist/server/dispatch-as-plurnk.js +7 -7
- package/dist/server/dispatch-as-plurnk.js.map +1 -1
- package/dist/server/drain.sql +27 -27
- package/dist/server/envelope.d.ts +20 -20
- package/dist/server/envelope.d.ts.map +1 -1
- package/dist/server/envelope.js +86 -86
- package/dist/server/envelope.js.map +1 -1
- package/dist/server/envelope.sql +39 -39
- package/dist/server/logEntry.d.ts +1 -1
- package/dist/server/logEntry.d.ts.map +1 -1
- package/dist/server/logEntry.js +1 -1
- package/dist/server/logEntry.js.map +1 -1
- package/dist/server/loop-model.d.ts +3 -0
- package/dist/server/loop-model.d.ts.map +1 -0
- package/dist/server/loop-model.js +26 -0
- package/dist/server/loop-model.js.map +1 -0
- package/dist/server/loopDocs.d.ts +1 -1
- package/dist/server/loopDocs.d.ts.map +1 -1
- package/dist/server/loopDocs.js +6 -6
- package/dist/server/loopDocs.js.map +1 -1
- package/dist/server/seam-entry-read.sql +2 -2
- package/dist/server/seam-log-read.sql +3 -3
- package/dist/server/seam-loop.sql +3 -3
- package/dist/server/seam-proposal-list.sql +4 -4
- package/dist/server/yolo.js +2 -2
- package/dist/server/yolo.js.map +1 -1
- package/dist/service.d.ts.map +1 -1
- package/dist/service.js +21 -6
- package/dist/service.js.map +1 -1
- package/migrations/0000-00-00.01_schema.sql +84 -85
- package/package.json +17 -14
- package/dist/core/TokenGauge.d.ts +0 -16
- package/dist/core/TokenGauge.d.ts.map +0 -1
- package/dist/core/TokenGauge.js +0 -58
- package/dist/core/TokenGauge.js.map +0 -1
- package/dist/core/run-cap.d.ts +0 -8
- package/dist/core/run-cap.d.ts.map +0 -1
- package/dist/core/run-cap.js +0 -20
- package/dist/core/run-cap.js.map +0 -1
- package/dist/core/search-prefetch.d.ts +0 -17
- package/dist/core/search-prefetch.d.ts.map +0 -1
- package/dist/core/search-prefetch.js +0 -164
- package/dist/core/search-prefetch.js.map +0 -1
- package/dist/core/session-settings.d.ts.map +0 -1
- package/dist/core/session-settings.js.map +0 -1
- package/dist/schemes/Run.d.ts.map +0 -1
- package/dist/schemes/Run.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CapsResolve.js","sourceRoot":"","sources":["../../../src/core/caps/CapsResolve.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,0EAA0E;AAC1E,+EAA+E;AAC/E,mDAAmD;AAKnD,MAAM,CAAC,OAAO,OAAO,WAAW;IAC5B,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,GAAwB,EAAE,MAAqB,EAAE,QAAgB;QAClF,MAAM,GAAG,GAAG,MAAO,GAAG,CAAC,EAAE,CAAC,
|
|
1
|
+
{"version":3,"file":"CapsResolve.js","sourceRoot":"","sources":["../../../src/core/caps/CapsResolve.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,0EAA0E;AAC1E,+EAA+E;AAC/E,mDAAmD;AAKnD,MAAM,CAAC,OAAO,OAAO,WAAW;IAC5B,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,GAAwB,EAAE,MAAqB,EAAE,QAAgB;QAClF,MAAM,GAAG,GAAG,MAAO,GAAG,CAAC,EAAE,CAAC,yBAAwC,CAAC,GAAG,CAAiB;YACnF,YAAY,EAAE,GAAG,CAAC,WAAW,EAAE,MAAM,EAAE,QAAQ;SAClD,CAAC,CAAC;QACH,OAAO,GAAG,EAAE,EAAE,IAAI,IAAI,CAAC;IAC3B,CAAC;CACJ"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// db-backed NotifyCaps (@plurnk/plurnk-schemes 0.4.3) — keystone PR-2 seam (#180).
|
|
2
2
|
// streamEvent fires a stream/event notification for a channel transition.
|
|
3
|
-
// (
|
|
3
|
+
// (wakeWorker was dropped in 0.4.3 — the rich run-wake lives on subscriptions.close,
|
|
4
4
|
// the only place with the close context to populate it.)
|
|
5
5
|
//
|
|
6
6
|
// streamEvent is sync per the cap contract, but the StreamEventPayload's entryId
|
|
@@ -29,7 +29,7 @@ export default class DbNotifyCaps {
|
|
|
29
29
|
if (entryId === null)
|
|
30
30
|
return;
|
|
31
31
|
const target = this.#scheme === null ? `file://${pathname}` : `${this.#scheme}://${pathname}`;
|
|
32
|
-
notify(this.#ctx.
|
|
32
|
+
notify(this.#ctx.workspaceId, { entryId, target, channel, state, contentLength });
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
//# sourceMappingURL=DbNotifyCaps.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DbNotifyCaps.js","sourceRoot":"","sources":["../../../src/core/caps/DbNotifyCaps.ts"],"names":[],"mappings":"AAAA,mFAAmF;AACnF,0EAA0E;AAC1E,
|
|
1
|
+
{"version":3,"file":"DbNotifyCaps.js","sourceRoot":"","sources":["../../../src/core/caps/DbNotifyCaps.ts"],"names":[],"mappings":"AAAA,mFAAmF;AACnF,0EAA0E;AAC1E,qFAAqF;AACrF,yDAAyD;AACzD,EAAE;AACF,iFAAiF;AACjF,6EAA6E;AAC7E,gFAAgF;AAChF,+BAA+B;AAK/B,OAAO,WAAW,MAAM,kBAAkB,CAAC;AAE3C,MAAM,CAAC,OAAO,OAAO,YAAY;IACpB,IAAI,CAAsB;IAC1B,OAAO,CAAgB;IAEhC,YAAY,GAAwB,EAAE,MAAqB;QACvD,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC;QAChB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IAC1B,CAAC;IAED,WAAW,CAAC,QAAgB,EAAE,OAAe,EAAE,KAAmB,EAAE,aAAqB;QACrF,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,iBAAiB,CAAC;QAC3C,IAAI,MAAM,KAAK,SAAS;YAAE,OAAO;QACjC,oFAAoF;QACpF,qFAAqF;QACrF,iEAAiE;QACjE,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,aAAa,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;IAChF,CAAC;IAED,KAAK,CAAC,KAAK,CAAC,MAAyB,EAAE,QAAgB,EAAE,OAAe,EAAE,KAAmB,EAAE,aAAqB;QAChH,MAAM,OAAO,GAAG,MAAM,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;QAC7E,IAAI,OAAO,KAAK,IAAI;YAAE,OAAO;QAC7B,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,KAAK,IAAI,CAAC,CAAC,CAAC,UAAU,QAAQ,EAAE,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,OAAO,MAAM,QAAQ,EAAE,CAAC;QAC9F,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,CAAC,CAAC;IACtF,CAAC;CACJ"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
// db-backed SubscriptionCaps (@plurnk/plurnk-schemes) — keystone PR-2 seam (#180).
|
|
2
2
|
// The streaming lifecycle a sibling drives:
|
|
3
3
|
// open(pathname, handle) → registers the subscription and hands back a
|
|
4
|
-
// run+teardown-composed AbortSignal; a
|
|
4
|
+
// run+teardown-composed AbortSignal; a worker abort also force-cancels the
|
|
5
5
|
// sibling's handle (mirrors the exec scheme's #activeAborts).
|
|
6
6
|
// notifyChunk(channel, chunk) → FUSED append-to-channel + stream/event.
|
|
7
7
|
// close(reason, outcome?) → composites every channel's terminal state, the
|
|
8
8
|
// registry close, and the rich run-wake (the only place with the close
|
|
9
|
-
// context to populate it — which is why NotifyCaps dropped
|
|
9
|
+
// context to populate it — which is why NotifyCaps dropped wakeWorker, #180).
|
|
10
10
|
// Stateful: open() binds the entry + subscription that notifyChunk()/close()
|
|
11
11
|
// operate on. Models src/schemes/Exec.ts over the same ChannelWrite primitives.
|
|
12
12
|
import ChannelWrite from "../ChannelWrite.js";
|
|
@@ -27,9 +27,9 @@ export default class DbSubscriptionCaps {
|
|
|
27
27
|
if (entryId === null)
|
|
28
28
|
throw new Error(`subscriptions.open: no entry at ${pathname}`);
|
|
29
29
|
const subscriptionId = await ChannelWrite.openSubscription(this.#ctx.db, {
|
|
30
|
-
|
|
30
|
+
workerId: this.#ctx.workerId, entryId, scheme: this.#scheme ?? "file", handle: pathname,
|
|
31
31
|
});
|
|
32
|
-
// Compose the
|
|
32
|
+
// Compose the worker signal with a fresh controller; a worker abort also
|
|
33
33
|
// force-cancels the sibling's handle.
|
|
34
34
|
const controller = new AbortController();
|
|
35
35
|
const parent = this.#ctx.signal;
|
|
@@ -64,7 +64,7 @@ export default class DbSubscriptionCaps {
|
|
|
64
64
|
const state = reason === "error" ? "errored" : "closed";
|
|
65
65
|
const closeStatus = reason === "error" ? 500 : 200;
|
|
66
66
|
// Every channel of the entry → terminal state, then the registry row
|
|
67
|
-
// closes, then the
|
|
67
|
+
// closes, then the worker wakes with the scheme's summary.
|
|
68
68
|
const channels = await this.#ctx.db.crud_read_channels.all({ entry_id: entryId });
|
|
69
69
|
for (const { name } of channels) {
|
|
70
70
|
await ChannelWrite.setChannelState(this.#ctx.db, { entryId, channel: name, state, notify: this.#ctx.streamEventNotify });
|
|
@@ -72,8 +72,8 @@ export default class DbSubscriptionCaps {
|
|
|
72
72
|
await ChannelWrite.closeSubscription(this.#ctx.db, { subscriptionId, status: closeStatus });
|
|
73
73
|
this.#unlink();
|
|
74
74
|
const target = this.#scheme === null ? `file://${this.#pathname}` : `${this.#scheme}://${this.#pathname}`;
|
|
75
|
-
this.#ctx.
|
|
76
|
-
|
|
75
|
+
this.#ctx.wakeWorkerNotify?.({
|
|
76
|
+
workspaceId: this.#ctx.workspaceId, workerId: this.#ctx.workerId,
|
|
77
77
|
entryId, target, subscriptionId, closeStatus,
|
|
78
78
|
scheme: this.#scheme ?? "file", summary: outcome ?? "",
|
|
79
79
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DbSubscriptionCaps.js","sourceRoot":"","sources":["../../../src/core/caps/DbSubscriptionCaps.ts"],"names":[],"mappings":"AAAA,mFAAmF;AACnF,4CAA4C;AAC5C,yEAAyE;AACzE
|
|
1
|
+
{"version":3,"file":"DbSubscriptionCaps.js","sourceRoot":"","sources":["../../../src/core/caps/DbSubscriptionCaps.ts"],"names":[],"mappings":"AAAA,mFAAmF;AACnF,4CAA4C;AAC5C,yEAAyE;AACzE,+EAA+E;AAC/E,kEAAkE;AAClE,0EAA0E;AAC1E,6EAA6E;AAC7E,2EAA2E;AAC3E,kFAAkF;AAClF,6EAA6E;AAC7E,gFAAgF;AAKhF,OAAO,YAAY,MAAM,oBAAoB,CAAC;AAC9C,OAAO,WAAW,MAAM,kBAAkB,CAAC;AAE3C,MAAM,CAAC,OAAO,OAAO,kBAAkB;IAC1B,IAAI,CAAsB;IAC1B,OAAO,CAAgB;IAChC,SAAS,GAAkB,IAAI,CAAC;IAChC,QAAQ,GAAkB,IAAI,CAAC;IAC/B,eAAe,GAAkB,IAAI,CAAC;IACtC,OAAO,GAAe,GAAG,EAAE,GAAE,CAAC,CAAC;IAE/B,YAAY,GAAwB,EAAE,MAAqB;QACvD,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC;QAChB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IAC1B,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,QAAgB,EAAE,MAA0B;QACnD,MAAM,OAAO,GAAG,MAAM,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;QAC7E,IAAI,OAAO,KAAK,IAAI;YAAE,MAAM,IAAI,KAAK,CAAC,mCAAmC,QAAQ,EAAE,CAAC,CAAC;QACrF,MAAM,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AC,IAAI,CAAC,EAAE,EAAE,EAAE,cAAc,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC,CAAC;QAC5F,IAAI,CAAC,OAAO,EAAE,CAAC;QACf,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,KAAK,IAAI,CAAC,CAAC,CAAC,UAAU,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,OAAO,MAAM,IAAI,CAAC,SAAS,EAAE,CAAC;QAC1G,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE,CAAC;YACzB,WAAW,EAAE,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,QAAQ,EAAE,IAAI,CAAC,IAAI,CAAC,QAAQ;YAChE,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,WAAW;YAC5C,MAAM,EAAE,IAAI,CAAC,OAAO,IAAI,MAAM,EAAE,OAAO,EAAE,OAAO,IAAI,EAAE;SACzD,CAAC,CAAC;QACH,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;QACtB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QACrB,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC;QAC5B,IAAI,CAAC,OAAO,GAAG,GAAS,EAAE,GAAE,CAAC,CAAC;IAClC,CAAC;CACJ"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { SchemeCtx, EntryCaps, ChannelCaps, TagCaps, NotifyCaps, SubscriptionCaps, CrossSchemeCaps, WriterTier } from "@plurnk/plurnk-schemes";
|
|
2
2
|
import type { PlurnkSchemeContext } from "../scheme-types.ts";
|
|
3
3
|
export default class SchemeCtxImpl implements SchemeCtx {
|
|
4
|
-
readonly
|
|
5
|
-
readonly
|
|
4
|
+
readonly workspaceId: number;
|
|
5
|
+
readonly workerId: number;
|
|
6
6
|
readonly loopId: number;
|
|
7
7
|
readonly turnId: number;
|
|
8
8
|
readonly writer: WriterTier;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SchemeCtxImpl.d.ts","sourceRoot":"","sources":["../../../src/core/caps/SchemeCtxImpl.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EACR,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,eAAe,EAAE,UAAU,EACxG,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAW9D,MAAM,CAAC,OAAO,OAAO,aAAc,YAAW,SAAS;IACnD,QAAQ,CAAC,
|
|
1
|
+
{"version":3,"file":"SchemeCtxImpl.d.ts","sourceRoot":"","sources":["../../../src/core/caps/SchemeCtxImpl.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EACR,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,eAAe,EAAE,UAAU,EACxG,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAW9D,MAAM,CAAC,OAAO,OAAO,aAAc,YAAW,SAAS;IACnD,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;IAC5B,QAAQ,CAAC,MAAM,EAAE,WAAW,GAAG,SAAS,CAAC;IACzC,QAAQ,CAAC,OAAO,EAAE,SAAS,CAAC;IAC5B,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAC;IAC/B,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;IAC5B,QAAQ,CAAC,aAAa,EAAE,gBAAgB,CAAC;IACzC,QAAQ,CAAC,WAAW,EAAE,eAAe,CAAqB;IAE1D,YAAY,GAAG,EAAE,mBAAmB,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,EAY1D;CACJ"}
|
|
@@ -13,8 +13,8 @@ const CROSS_SCHEME_STUB = {
|
|
|
13
13
|
_deferred: "see plurnk-service#180 — designed when first cross-scheme COPY/MOVE forces the FROM/TO shape",
|
|
14
14
|
};
|
|
15
15
|
export default class SchemeCtxImpl {
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
workspaceId;
|
|
17
|
+
workerId;
|
|
18
18
|
loopId;
|
|
19
19
|
turnId;
|
|
20
20
|
writer;
|
|
@@ -26,8 +26,8 @@ export default class SchemeCtxImpl {
|
|
|
26
26
|
subscriptions;
|
|
27
27
|
crossScheme = CROSS_SCHEME_STUB;
|
|
28
28
|
constructor(ctx, scheme) {
|
|
29
|
-
this.
|
|
30
|
-
this.
|
|
29
|
+
this.workspaceId = ctx.workspaceId;
|
|
30
|
+
this.workerId = ctx.workerId;
|
|
31
31
|
this.loopId = ctx.loopId;
|
|
32
32
|
this.turnId = ctx.turnId;
|
|
33
33
|
this.writer = ctx.writer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SchemeCtxImpl.js","sourceRoot":"","sources":["../../../src/core/caps/SchemeCtxImpl.ts"],"names":[],"mappings":"AAAA,iFAAiF;AACjF,kFAAkF;AAClF,+EAA+E;AAC/E,kFAAkF;AAClF,sFAAsF;AACtF,wEAAwE;AAMxE,OAAO,WAAW,MAAM,kBAAkB,CAAC;AAC3C,OAAO,aAAa,MAAM,oBAAoB,CAAC;AAC/C,OAAO,SAAS,MAAM,gBAAgB,CAAC;AACvC,OAAO,YAAY,MAAM,mBAAmB,CAAC;AAC7C,OAAO,kBAAkB,MAAM,yBAAyB,CAAC;AAEzD,MAAM,iBAAiB,GAAoB;IACvC,SAAS,EAAE,8FAA8F;CAC5G,CAAC;AAEF,MAAM,CAAC,OAAO,OAAO,aAAa;IACrB,
|
|
1
|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AAC;QAC/C,IAAI,CAAC,IAAI,GAAG,IAAI,SAAS,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;QACvC,IAAI,CAAC,MAAM,GAAG,IAAI,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;QAC5C,IAAI,CAAC,aAAa,GAAG,IAAI,kBAAkB,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;IAC7D,CAAC;CACJ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content-hash.d.ts","sourceRoot":"","sources":["../../src/core/content-hash.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,WAAW,YAAa,MAAM,KAAG,MAA4D,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
// Content identity — the sha256 of a channel's content, stamped at entry-write
|
|
3
|
+
// (entry_channels.content_hash). A stable per-content key; the per-model token cache that once
|
|
4
|
+
// rode it was retired with the agnostic-ruler simplification (§tokenomics-agnostic-ruler).
|
|
5
|
+
export const contentHash = (content) => createHash("sha256").update(content).digest("hex");
|
|
6
|
+
//# sourceMappingURL=content-hash.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content-hash.js","sourceRoot":"","sources":["../../src/core/content-hash.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,+EAA+E;AAC/E,+FAA+F;AAC/F,2FAA2F;AAC3F,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,OAAe,EAAU,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC"}
|
package/dist/core/fork.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Db } from "./Db.ts";
|
|
2
2
|
export default class Fork {
|
|
3
3
|
#private;
|
|
4
|
-
static fork(db: Db,
|
|
4
|
+
static fork(db: Db, parentWorkerId: number, name?: string): Promise<number>;
|
|
5
5
|
}
|
|
6
6
|
//# sourceMappingURL=fork.d.ts.map
|
package/dist/core/fork.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fork.d.ts","sourceRoot":"","sources":["../../src/core/fork.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,EAAE,EAAc,MAAM,SAAS,CAAC;AAE9C,MAAM,CAAC,OAAO,OAAO,IAAI;;IAIrB,OAAa,IAAI,CAAC,EAAE,EAAE,EAAE,EAAE,
|
|
1
|
+
{"version":3,"file":"fork.d.ts","sourceRoot":"","sources":["../../src/core/fork.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,EAAE,EAAc,MAAM,SAAS,CAAC;AAE9C,MAAM,CAAC,OAAO,OAAO,IAAI;;IAIrB,OAAa,IAAI,CAAC,EAAE,EAAE,EAAE,EAAE,cAAc,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CA6EhF;CACJ"}
|
package/dist/core/fork.js
CHANGED
|
@@ -1,55 +1,55 @@
|
|
|
1
|
-
// Fork a
|
|
1
|
+
// Fork a worker — branch the log, share the workspace (SPEC §machine-processes).
|
|
2
2
|
//
|
|
3
|
-
// A fork is a NEW run in the SAME
|
|
3
|
+
// A fork is a NEW run in the SAME workspace (`parent_worker_id` records the lineage),
|
|
4
4
|
// holding a deep copy of the parent's log: loops → turns → entries, with their
|
|
5
5
|
// fold-state (`expanded`) and attribution (`origin`/`source`) intact. It copies
|
|
6
|
-
// nothing of the shared WORLD — the
|
|
7
|
-
// copied, because a
|
|
8
|
-
// SCRATCH (§
|
|
6
|
+
// nothing of the shared WORLD — the workspace's entries and overlay are shared, never
|
|
7
|
+
// copied, because a worker never owned them. But it DOES inherit the parent's worker-scope
|
|
8
|
+
// SCRATCH (§worker-scheme — the worker's private workspace, owner-remapped parent → branch):
|
|
9
9
|
// "fork = everything-in-common-but-name, then diverges". The §env-delta reconciliation
|
|
10
10
|
// snapshot is not copied; the branch first-sights its world like any fresh run.
|
|
11
11
|
export default class Fork {
|
|
12
12
|
// Terminal loop statuses (§lifecycle-terms) — inherited loops outside this set are clamped to 200.
|
|
13
13
|
static #TERMINAL_LOOP = new Set([200, 413, 429, 499, 500, 504, 508]);
|
|
14
|
-
static async fork(db,
|
|
15
|
-
const parent = await db.
|
|
14
|
+
static async fork(db, parentWorkerId, name) {
|
|
15
|
+
const parent = await db.fork_get_worker.get({ id: parentWorkerId });
|
|
16
16
|
if (parent === undefined)
|
|
17
|
-
throw new Error(`fork: run ${
|
|
17
|
+
throw new Error(`fork: run ${parentWorkerId} not found`);
|
|
18
18
|
// #248 — name the branch at instantiation (immutable after). An explicit name wins; the default
|
|
19
19
|
// is `<parent>-fork-<N>` (N = next free), so N self-forks of one parent are individually
|
|
20
|
-
// addressable instead of all colliding on a single `<parent>-fork` (§
|
|
20
|
+
// addressable instead of all colliding on a single `<parent>-fork` (§worker-scheme-fork).
|
|
21
21
|
let branchName = name;
|
|
22
22
|
if (branchName === undefined) {
|
|
23
|
-
const existing = await db.fork_count_branches.get({
|
|
23
|
+
const existing = await db.fork_count_branches.get({ parent_worker_id: parentWorkerId, name_prefix: `${parent.name}-fork%` });
|
|
24
24
|
branchName = `${parent.name}-fork-${(existing?.n ?? 0) + 1}`;
|
|
25
25
|
}
|
|
26
|
-
const branch = await db.
|
|
27
|
-
|
|
26
|
+
const branch = await db.fork_insert_worker.get({
|
|
27
|
+
workspace_id: parent.workspace_id, name: branchName, parent_worker_id: parentWorkerId, origin: parent.origin,
|
|
28
28
|
});
|
|
29
29
|
if (branch === undefined)
|
|
30
30
|
throw new Error("fork: branch run insert returned no row");
|
|
31
|
-
const
|
|
31
|
+
const branchWorkerId = branch.id;
|
|
32
32
|
// loops → new loops, mapping old id → new id. A copied loop is INHERITED HISTORY, never the
|
|
33
|
-
// branch's live work (its own loop is enqueued fresh by
|
|
33
|
+
// branch's live work (its own loop is enqueued fresh by injectWorker) — so a non-terminal status
|
|
34
34
|
// is clamped to terminal (200). Otherwise a fork taken while the parent's loop is mid-flight (102)
|
|
35
35
|
// would carry a frozen-live loop no drain ever advances, falsely marking the branch forever-live
|
|
36
|
-
// to any liveness check (§
|
|
37
|
-
const loops = await db.fork_get_loops.all({
|
|
36
|
+
// to any liveness check (§worker-scheme-fork, the premature-terminate gate §send-premature-terminate).
|
|
37
|
+
const loops = await db.fork_get_loops.all({ worker_id: parentWorkerId });
|
|
38
38
|
const loopMap = new Map();
|
|
39
39
|
for (const l of loops) {
|
|
40
40
|
const status = Fork.#TERMINAL_LOOP.has(l.status) ? l.status : 200;
|
|
41
|
-
const nl = await db.fork_insert_loop.get({
|
|
41
|
+
const nl = await db.fork_insert_loop.get({ worker_id: branchWorkerId, sequence: l.sequence, status, prompt: l.prompt, flags: l.flags });
|
|
42
42
|
if (nl === undefined)
|
|
43
43
|
throw new Error("fork: loop insert returned no row");
|
|
44
44
|
loopMap.set(l.id, nl.id);
|
|
45
45
|
}
|
|
46
46
|
// turns → new turns, loop_id remapped, mapping old id → new id.
|
|
47
|
-
const turns = await db.fork_get_turns.all({
|
|
47
|
+
const turns = await db.fork_get_turns.all({ worker_id: parentWorkerId });
|
|
48
48
|
const turnMap = new Map();
|
|
49
49
|
for (const { id, loop_id, ...rest } of turns) {
|
|
50
50
|
// #254 — a fork inherits the parent's log for context but spends no new money:
|
|
51
51
|
// the copied turns are history, not fresh generations. Zero their usage so the
|
|
52
|
-
// cost-rollup triggers add nothing — the
|
|
52
|
+
// cost-rollup triggers add nothing — the workspace total stays true lifetime spend
|
|
53
53
|
// (no double-count) and the branch's cost_pico accrues only what IT generates.
|
|
54
54
|
const nt = await db.fork_insert_turn.get({
|
|
55
55
|
...rest, usage_prompt: 0, usage_completion: 0, usage_reasoning: 0, usage_cached: 0, usage_cost_pico: 0,
|
|
@@ -61,24 +61,29 @@ export default class Fork {
|
|
|
61
61
|
}
|
|
62
62
|
// entries → new entries: run/loop/turn ids remapped; fold-state and
|
|
63
63
|
// attribution and content all preserved.
|
|
64
|
-
const entries = await db.fork_get_log_entries.all({
|
|
64
|
+
const entries = await db.fork_get_log_entries.all({ worker_id: parentWorkerId });
|
|
65
65
|
for (const e of entries) {
|
|
66
|
-
|
|
66
|
+
const { id: oldLogId, ...row } = e;
|
|
67
|
+
const ne = await db.fork_insert_log_entry.get({ ...row, worker_id: branchWorkerId, loop_id: loopMap.get(e.loop_id), turn_id: turnMap.get(e.turn_id) });
|
|
68
|
+
if (ne === undefined)
|
|
69
|
+
throw new Error("fork: log entry copy returned no row");
|
|
70
|
+
// §log-region-tagging — carry the row's region tags onto the copy (no-op when untagged).
|
|
71
|
+
await db.fork_copy_log_tags.run({ old_log_id: oldLogId, new_log_id: ne.id });
|
|
67
72
|
}
|
|
68
|
-
// §
|
|
73
|
+
// §worker-scheme — inherit the parent's worker-scope SCRATCH, owner remapped (parent → branch) in
|
|
69
74
|
// the pathname so the branch's private workspace is independent and diverges on its own edits.
|
|
70
75
|
const parentPrefix = `/${parent.name}/`;
|
|
71
76
|
const branchPrefix = `/${branchName}/`;
|
|
72
|
-
const scratch = await db.
|
|
77
|
+
const scratch = await db.fork_get_worker_scope_entries.all({ workspace_id: parent.workspace_id, owner_prefix: `${parentPrefix}*` });
|
|
73
78
|
for (const s of scratch) {
|
|
74
79
|
const newPathname = branchPrefix + s.pathname.slice(parentPrefix.length);
|
|
75
|
-
const ne = await db.
|
|
80
|
+
const ne = await db.fork_insert_worker_scope_entry.get({ workspace_id: parent.workspace_id, scheme: s.scheme, pathname: newPathname, deep_hash: s.deep_hash, attributes: s.attributes });
|
|
76
81
|
if (ne === undefined)
|
|
77
|
-
throw new Error("fork:
|
|
82
|
+
throw new Error("fork: worker-scope entry copy returned no row");
|
|
78
83
|
await db.fork_copy_entry_channels.run({ old_entry_id: s.id, new_entry_id: ne.id });
|
|
79
84
|
await db.fork_copy_entry_tags.run({ old_entry_id: s.id, new_entry_id: ne.id });
|
|
80
85
|
}
|
|
81
|
-
return
|
|
86
|
+
return branchWorkerId;
|
|
82
87
|
}
|
|
83
88
|
}
|
|
84
89
|
//# sourceMappingURL=fork.js.map
|
package/dist/core/fork.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fork.js","sourceRoot":"","sources":["../../src/core/fork.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"fork.js","sourceRoot":"","sources":["../../src/core/fork.ts"],"names":[],"mappings":"AAAA,iFAAiF;AACjF,EAAE;AACF,sFAAsF;AACtF,+EAA+E;AAC/E,gFAAgF;AAChF,sFAAsF;AACtF,2FAA2F;AAC3F,6FAA6F;AAC7F,uFAAuF;AACvF,gFAAgF;AAIhF,MAAM,CAAC,OAAO,OAAO,IAAI;IACrB,mGAAmG;IACnG,MAAM,CAAC,cAAc,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;IAErE,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,EAAM,EAAE,cAAsB,EAAE,IAAa;QAC3D,MAAM,MAAM,GAAG,MAAO,EAAE,CAAC,eAA8B,CAAC,GAAG,CAAyD,EAAE,EAAE,EAAE,cAAc,EAAE,CAAC,CAAC;QAC5I,IAAI,MAAM,KAAK,SAAS;YAAE,MAAM,IAAI,KAAK,CAAC,aAAa,cAAc,YAAY,CAAC,CAAC;QAEnF,gGAAgG;QAChG,yFAAyF;QACzF,0FAA0F;QAC1F,IAAI,UAAU,GAAG,IAAI,CAAC;QACtB,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;YAC3B,MAAM,QAAQ,GAAG,MAAO,EAAE,CAAC,mBAAkC,CAAC,GAAG,CAAgB,EAAE,gBAAgB,EAAE,cAAc,EAAE,WAAW,EAAE,GAAG,MAAM,CAAC,IAAI,QAA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C,wBAAuC,CAAC,GAAG,CAAC,EAAE,YAAY,EAAE,CAAC,CAAC,EAAE,EAAE,YAAY,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;YACnG,MAAO,EAAE,CAAC,oBAAmC,CAAC,GAAG,CAAC,EAAE,YAAY,EAAE,CAAC,CAAC,EAAE,EAAE,YAAY,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;QACnG,CAAC;QAED,OAAO,cAAc,CAAC;IAC1B,CAAC;CACJ"}
|
package/dist/core/fork.sql
CHANGED
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
-- Fork a
|
|
1
|
+
-- Fork a worker: deep-copy its log into a NEW run in the SAME workspace (SPEC §machine-processes —
|
|
2
2
|
-- branch the log, share the world). loops → turns → entries are copied with their
|
|
3
|
-
-- fold-state (expanded) and attribution (origin/source) intact; only the
|
|
4
|
-
-- turn ids are remapped. Nothing of the world is copied (§machine-processes-fork-shares-the-world) — the
|
|
5
|
-
-- overlay are shared. The §env-delta reconciliation snapshot (
|
|
3
|
+
-- fold-state (expanded) and attribution (origin/source) intact; only the worker/loop/
|
|
4
|
+
-- turn ids are remapped. Nothing of the world is copied (§machine-processes-fork-shares-the-world) — the workspace's entries and
|
|
5
|
+
-- overlay are shared. The §env-delta reconciliation snapshot (worker_watermarks) is NOT
|
|
6
6
|
-- copied; the branch first-sights its world like any fresh run.
|
|
7
7
|
|
|
8
|
-
-- PREP:
|
|
9
|
-
SELECT
|
|
8
|
+
-- PREP: fork_get_worker
|
|
9
|
+
SELECT workspace_id, name, origin FROM workers WHERE id = $id;
|
|
10
10
|
|
|
11
|
-
-- PREP:
|
|
12
|
-
-- A new
|
|
13
|
-
INSERT INTO
|
|
14
|
-
VALUES ($
|
|
11
|
+
-- PREP: fork_insert_worker
|
|
12
|
+
-- A new worker in the parent's workspace; lineage recorded via parent_worker_id (§lifecycle-terms).
|
|
13
|
+
INSERT INTO workers (workspace_id, name, parent_worker_id, origin)
|
|
14
|
+
VALUES ($workspace_id, $name, $parent_worker_id, $origin)
|
|
15
15
|
RETURNING id;
|
|
16
16
|
|
|
17
17
|
-- PREP: fork_count_branches
|
|
18
18
|
-- How many fork branches the parent already has — for a UNIQUE `<parent>-fork-<N>` default name, so N
|
|
19
19
|
-- self-forks of one parent are individually addressable (KILL/SEND/READ by name) instead of colliding
|
|
20
|
-
-- on a single `<parent>-fork` that
|
|
21
|
-
SELECT COUNT(*) AS n FROM
|
|
20
|
+
-- on a single `<parent>-fork` that worker_resolve_by_name would resolve to the newest only (§worker-scheme-fork).
|
|
21
|
+
SELECT COUNT(*) AS n FROM workers WHERE parent_worker_id = $parent_worker_id AND name LIKE $name_prefix;
|
|
22
22
|
|
|
23
23
|
-- PREP: fork_get_loops
|
|
24
24
|
SELECT id, sequence, status, prompt, flags
|
|
25
|
-
FROM loops WHERE
|
|
25
|
+
FROM loops WHERE worker_id = $worker_id ORDER BY id;
|
|
26
26
|
|
|
27
27
|
-- PREP: fork_insert_loop
|
|
28
|
-
INSERT INTO loops (
|
|
29
|
-
VALUES ($
|
|
28
|
+
INSERT INTO loops (worker_id, sequence, status, prompt, flags)
|
|
29
|
+
VALUES ($worker_id, $sequence, $status, $prompt, $flags)
|
|
30
30
|
RETURNING id;
|
|
31
31
|
|
|
32
32
|
-- PREP: fork_get_turns
|
|
33
|
-
-- All turns across the
|
|
33
|
+
-- All turns across the worker's loops, in order — loop_id is remapped by the caller.
|
|
34
34
|
SELECT t.id, t.loop_id, t.sequence, t.timestamp, t.status,
|
|
35
35
|
t.usage_prompt, t.usage_completion, t.usage_cached, t.usage_cost_pico,
|
|
36
36
|
t.packet, t.finish_reason, t.model
|
|
37
37
|
FROM turns t JOIN loops l ON l.id = t.loop_id
|
|
38
|
-
WHERE l.
|
|
38
|
+
WHERE l.worker_id = $worker_id ORDER BY t.id;
|
|
39
39
|
|
|
40
40
|
-- PREP: fork_insert_turn
|
|
41
41
|
INSERT INTO turns (loop_id, sequence, timestamp, status, usage_prompt, usage_completion, usage_reasoning, usage_cached, usage_cost_pico, packet, finish_reason, model)
|
|
@@ -43,35 +43,44 @@ VALUES ($loop_id, $sequence, $timestamp, $status, $usage_prompt, $usage_completi
|
|
|
43
43
|
RETURNING id;
|
|
44
44
|
|
|
45
45
|
-- PREP: fork_get_log_entries
|
|
46
|
-
--
|
|
47
|
-
--
|
|
48
|
-
|
|
46
|
+
-- worker_id is the branch's; loop_id/turn_id are remapped by the caller. The source `id` rides along so
|
|
47
|
+
-- the caller can carry §log-region-tagging tags across (old id → new id). origin/source (attribution)
|
|
48
|
+
-- and expanded (fold-state) ride along too. §machine-processes-fork-copies-the-log
|
|
49
|
+
SELECT id, loop_id, turn_id, sequence, at, origin, source, op, suffix, signal,
|
|
49
50
|
scheme, username, password, hostname, port, pathname, params, fragment,
|
|
50
51
|
lineMarker, tx, mimetype_tx, rx, mimetype_rx, status_rx, tokens,
|
|
51
52
|
state, outcome, attrs, expanded
|
|
52
|
-
FROM log_entries WHERE
|
|
53
|
+
FROM log_entries WHERE worker_id = $worker_id ORDER BY id;
|
|
53
54
|
|
|
54
55
|
-- PREP: fork_insert_log_entry
|
|
55
|
-
|
|
56
|
-
|
|
56
|
+
-- RETURNING the new id so the caller can copy the row's region tags onto it (§log-region-tagging).
|
|
57
|
+
INSERT INTO log_entries (worker_id, loop_id, turn_id, sequence, at, origin, source, op, suffix, signal, scheme, username, password, hostname, port, pathname, params, fragment, lineMarker, tx, mimetype_tx, rx, mimetype_rx, status_rx, tokens, state, outcome, attrs, expanded)
|
|
58
|
+
VALUES ($worker_id, $loop_id, $turn_id, $sequence, $at, $origin, $source, $op, $suffix, $signal, $scheme, $username, $password, $hostname, $port, $pathname, $params, $fragment, $lineMarker, $tx, $mimetype_tx, $rx, $mimetype_rx, $status_rx, $tokens, $state, $outcome, $attrs, $expanded)
|
|
59
|
+
RETURNING id;
|
|
60
|
+
|
|
61
|
+
-- PREP: fork_copy_log_tags
|
|
62
|
+
-- §log-region-tagging + §machine-processes-fork-copies-the-log — a forked log row keeps its region
|
|
63
|
+
-- tags along with its fold-state, so a branch inherits the parent's named working-sets.
|
|
64
|
+
INSERT INTO log_tags (log_entry_id, tag)
|
|
65
|
+
SELECT $new_log_id, tag FROM log_tags WHERE log_entry_id = $old_log_id;
|
|
57
66
|
|
|
58
|
-
-- §
|
|
59
|
-
-- from the shared
|
|
67
|
+
-- §worker-scheme — a fork inherits the parent's worker-scope SCRATCH (its private workspace), distinct
|
|
68
|
+
-- from the shared workspace world above: "fork = everything-in-common-but-name, then diverges". The
|
|
60
69
|
-- entries are deep-copied (new ids) with the owner remapped in the pathname (parent → branch), so
|
|
61
70
|
-- the branch's scratch is independent — it edits its own without touching the parent's.
|
|
62
71
|
|
|
63
|
-
-- PREP:
|
|
64
|
-
-- The parent's
|
|
72
|
+
-- PREP: fork_get_worker_scope_entries
|
|
73
|
+
-- The parent's worker-scope entries (owner = the parent's worker name, prefix `/<parent>/*`). deep_hash
|
|
65
74
|
-- and attributes ride along; copying the channels with their tokens keeps the deep_hash valid so
|
|
66
75
|
-- the next-turn pump skips re-derivation (the content is byte-identical).
|
|
67
76
|
SELECT id, scheme, pathname, deep_hash, attributes
|
|
68
|
-
FROM entries WHERE scope = '
|
|
77
|
+
FROM entries WHERE scope = 'worker' AND workspace_id = $workspace_id AND pathname GLOB $owner_prefix ORDER BY id;
|
|
69
78
|
|
|
70
|
-
-- PREP:
|
|
71
|
-
-- A
|
|
79
|
+
-- PREP: fork_insert_worker_scope_entry
|
|
80
|
+
-- A worker-scope entry copy with the owner-remapped pathname. synced_sig/membership_origin are NULL
|
|
72
81
|
-- (scratch is never disk-synced nor a file member); version defaults 0.
|
|
73
|
-
INSERT INTO entries (scope,
|
|
74
|
-
VALUES ('
|
|
82
|
+
INSERT INTO entries (scope, workspace_id, scheme, pathname, deep_hash, attributes)
|
|
83
|
+
VALUES ('worker', $workspace_id, $scheme, $pathname, $deep_hash, $attributes)
|
|
75
84
|
RETURNING id;
|
|
76
85
|
|
|
77
86
|
-- PREP: fork_copy_entry_channels
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"git-env.d.ts","sourceRoot":"","sources":["../../src/core/git-env.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"git-env.d.ts","sourceRoot":"","sources":["../../src/core/git-env.ts"],"names":[],"mappings":"AAkBA,eAAO,MAAM,cAAc,QAAO,MAAM,CAAC,UAIvC,CAAC"}
|
package/dist/core/git-env.js
CHANGED
|
@@ -1,8 +1,24 @@
|
|
|
1
|
-
// Ambient GIT_* is scrubbed at the one boundary that spawns git
|
|
2
|
-
//
|
|
3
|
-
// the
|
|
4
|
-
//
|
|
5
|
-
//
|
|
6
|
-
//
|
|
7
|
-
|
|
1
|
+
// Ambient GIT_* is scrubbed at the one boundary that spawns git — post-#461 that boundary is
|
|
2
|
+
// the PLURNK_SERVICE_GIT_NATIVE=1 arm (GitMembership/GitState routing to system git) plus the
|
|
3
|
+
// intg git fixtures; the default GitIso backend never spawns and never reads env, so it needs
|
|
4
|
+
// none of this. A process launched from a git hook inherits GIT_DIR — ABSOLUTE in a worktree
|
|
5
|
+
// checkout — which retargets every child git at the enclosing repo regardless of cwd (#401:
|
|
6
|
+
// the pre-push drill's fixture seeds stacked onto lane branches and deleted tracked files; a
|
|
7
|
+
// hook-launched daemon would misread project git state the same way). Git resolves everything
|
|
8
|
+
// it needs from cwd; project state binds to the workspace's project_root, never to whoever
|
|
9
|
+
// spawned us.
|
|
10
|
+
//
|
|
11
|
+
// AND the machine's GLOBAL/SYSTEM config is severed (#428): a sandbox git op that reads
|
|
12
|
+
// ~/.gitconfig picks up the user's `core.hooksPath` — the dotfiles hook symlinked from
|
|
13
|
+
// ~/.git/templates/hooks — and a probe overwrote that global hook with `exit 1`, silently failing
|
|
14
|
+
// every leaf repo's push for a day (a recurrence of #401's class via the global-config vector).
|
|
15
|
+
// Pointing GIT_CONFIG_GLOBAL/SYSTEM at /dev/null means NO git op we spawn can read, invoke, or
|
|
16
|
+
// write the machine's global hooks/config — membership is repo-scoped and machine-deterministic,
|
|
17
|
+
// and a sandbox can never escape to ~/.git or ~/.gitconfig. (Our reads — ls-files/rev-parse — need
|
|
18
|
+
// no user identity; `--exclude-standard` honors the repo's own .gitignore, never a global one.)
|
|
19
|
+
export const hermeticGitEnv = () => ({
|
|
20
|
+
...Object.fromEntries(Object.entries(process.env).filter(([k]) => !k.startsWith("GIT_"))),
|
|
21
|
+
GIT_CONFIG_GLOBAL: "/dev/null",
|
|
22
|
+
GIT_CONFIG_SYSTEM: "/dev/null",
|
|
23
|
+
});
|
|
8
24
|
//# sourceMappingURL=git-env.js.map
|
package/dist/core/git-env.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"git-env.js","sourceRoot":"","sources":["../../src/core/git-env.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"git-env.js","sourceRoot":"","sources":["../../src/core/git-env.ts"],"names":[],"mappings":"AAAA,6FAA6F;AAC7F,8FAA8F;AAC9F,8FAA8F;AAC9F,6FAA6F;AAC7F,4FAA4F;AAC5F,6FAA6F;AAC7F,8FAA8F;AAC9F,2FAA2F;AAC3F,cAAc;AACd,EAAE;AACF,wFAAwF;AACxF,uFAAuF;AACvF,kGAAkG;AAClG,gGAAgG;AAChG,+FAA+F;AAC/F,iGAAiG;AACjG,mGAAmG;AACnG,gGAAgG;AAChG,MAAM,CAAC,MAAM,cAAc,GAAG,GAAsB,EAAE,CAAC,CAAC;IACpD,GAAG,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC;IACzF,iBAAiB,EAAE,WAAW;IAC9B,iBAAiB,EAAE,WAAW;CACjC,CAAC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { GitStatus } from "./git-state.ts";
|
|
2
|
+
export default class GitIso {
|
|
3
|
+
#private;
|
|
4
|
+
static trackedFiles(root: string, cache: object): Promise<string[]>;
|
|
5
|
+
static untrackedFiles(root: string, cache: object): Promise<string[]>;
|
|
6
|
+
static repoToplevel(dir: string): Promise<string | null>;
|
|
7
|
+
static status(root: string): Promise<GitStatus>;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=git-iso.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git-iso.d.ts","sourceRoot":"","sources":["../../src/core/git-iso.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEhD,MAAM,CAAC,OAAO,OAAO,MAAM;;IAoCvB,OAAa,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAExE;IAaD,OAAa,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CA2C1E;IAwBD,OAAa,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAM7D;IAMD,OAAa,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAcpD;CAwCJ"}
|