@plurnk/plurnk-service 1.3.4 → 1.3.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/INSTALL.md +3 -1
- package/SPEC.md +116 -12
- package/dist/build-info.json +1 -1
- package/dist/core/Engine.d.ts +1 -1
- package/dist/core/Engine.d.ts.map +1 -1
- package/dist/core/Engine.js +14 -10
- package/dist/core/Engine.js.map +1 -1
- package/dist/core/Engine.sql +6 -8
- package/dist/core/ProviderInstantiate.d.ts.map +1 -1
- package/dist/core/ProviderInstantiate.js +7 -39
- package/dist/core/ProviderInstantiate.js.map +1 -1
- package/dist/core/fork.js +2 -2
- package/dist/core/fork.js.map +1 -1
- package/dist/core/fork.sql +3 -3
- package/dist/digest/Digest.js +6 -6
- package/dist/digest/Digest.js.map +1 -1
- package/dist/digest/digest.sql +2 -2
- package/dist/schemes/exec-env.d.ts +0 -1
- package/dist/schemes/exec-env.d.ts.map +1 -1
- package/dist/schemes/exec-env.js +13 -9
- package/dist/schemes/exec-env.js.map +1 -1
- package/dist/server/Daemon.d.ts +1 -1
- package/dist/server/Daemon.d.ts.map +1 -1
- package/dist/server/Daemon.js +1 -1
- package/dist/server/Daemon.js.map +1 -1
- package/dist/server/envelope.d.ts +2 -2
- package/dist/server/envelope.d.ts.map +1 -1
- package/dist/server/envelope.sql +2 -2
- package/migrations/0000-00-00.01_schema.sql +13 -13
- package/package.json +16 -19
|
@@ -11,7 +11,7 @@ CREATE TABLE IF NOT EXISTS workspaces (
|
|
|
11
11
|
version INTEGER NOT NULL DEFAULT 0 CHECK (version >= 0),
|
|
12
12
|
name TEXT NOT NULL UNIQUE CHECK (length(name) > 0),
|
|
13
13
|
created_at TEXT NOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ', 'now')),
|
|
14
|
-
|
|
14
|
+
cost_usd REAL NOT NULL DEFAULT 0 CHECK (cost_usd >= 0),
|
|
15
15
|
scheme_registry_additions TEXT NOT NULL DEFAULT '[]' CHECK (json_valid(scheme_registry_additions)),
|
|
16
16
|
project_root TEXT,
|
|
17
17
|
-- #231 client-chosen workspace-open context: { manifestItems?, mdDocs? }, read at turn-0
|
|
@@ -30,7 +30,7 @@ CREATE TABLE IF NOT EXISTS workers (
|
|
|
30
30
|
created_at TEXT NOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ', 'now')),
|
|
31
31
|
-- runs fork via parent_worker_id; workspaces carry no parent — §machine-processes-no-fork-workspace
|
|
32
32
|
parent_worker_id INTEGER CHECK (parent_worker_id IS NULL OR parent_worker_id != id),
|
|
33
|
-
|
|
33
|
+
cost_usd REAL NOT NULL DEFAULT 0 CHECK (cost_usd >= 0),
|
|
34
34
|
origin TEXT NOT NULL DEFAULT 'client' CHECK (origin IN ('model', 'client', 'plurnk')),
|
|
35
35
|
FOREIGN KEY (workspace_id) REFERENCES workspaces(id) ON DELETE CASCADE,
|
|
36
36
|
FOREIGN KEY (parent_worker_id) REFERENCES workers(id) ON DELETE CASCADE
|
|
@@ -107,7 +107,7 @@ CREATE TABLE IF NOT EXISTS turns (
|
|
|
107
107
|
usage_completion INTEGER NOT NULL DEFAULT 0 CHECK (usage_completion >= 0),
|
|
108
108
|
usage_reasoning INTEGER NOT NULL DEFAULT 0 CHECK (usage_reasoning >= 0),
|
|
109
109
|
usage_cached INTEGER NOT NULL DEFAULT 0 CHECK (usage_cached >= 0),
|
|
110
|
-
|
|
110
|
+
usage_cost_usd REAL NOT NULL DEFAULT 0 CHECK (usage_cost_usd >= 0),
|
|
111
111
|
-- #274 — the context window of the model that RAN this turn (provider.contextSize), so the
|
|
112
112
|
-- gauge denominator matches the loop's actual model under any /model switch. NULL = the
|
|
113
113
|
-- provider can't report a window (the client omits the gauge).
|
|
@@ -115,7 +115,7 @@ CREATE TABLE IF NOT EXISTS turns (
|
|
|
115
115
|
packet TEXT NOT NULL CHECK (json_valid(packet)),
|
|
116
116
|
finish_reason TEXT,
|
|
117
117
|
model TEXT NOT NULL DEFAULT 'unknown' CHECK (length(model) >= 1),
|
|
118
|
-
-- #252 — opaque provider→client metadata passthrough
|
|
118
|
+
-- #252 — opaque provider→client metadata passthrough. Stored
|
|
119
119
|
-- UNENFORCED (json_valid only, no schema): the canonical-field contract lives between
|
|
120
120
|
-- the provider framework (normalizes) and the client (renders) — the service authors
|
|
121
121
|
-- only the engine-stamped rail keys ({§rail-truth-engine-verdict}, #534).
|
|
@@ -434,14 +434,14 @@ CREATE TABLE IF NOT EXISTS providers (
|
|
|
434
434
|
CREATE INDEX IF NOT EXISTS providers_created_at ON providers (created_at);
|
|
435
435
|
|
|
436
436
|
-- cost_rollups
|
|
437
|
-
-- Triggers maintaining denormalized
|
|
437
|
+
-- Triggers maintaining denormalized cost_usd totals on runs and workspaces
|
|
438
438
|
-- as turns insert/update. Pure denormalization (textbook trigger use);
|
|
439
439
|
-- no branching state-machine logic lives here.
|
|
440
440
|
CREATE TRIGGER IF NOT EXISTS turns_cost_rollup_insert_worker
|
|
441
441
|
AFTER INSERT ON turns
|
|
442
442
|
BEGIN
|
|
443
443
|
UPDATE workers
|
|
444
|
-
SET
|
|
444
|
+
SET cost_usd = cost_usd + NEW.usage_cost_usd
|
|
445
445
|
WHERE id = (SELECT worker_id FROM loops WHERE id = NEW.loop_id);
|
|
446
446
|
END;
|
|
447
447
|
|
|
@@ -449,7 +449,7 @@ CREATE TRIGGER IF NOT EXISTS turns_cost_rollup_insert_workspace
|
|
|
449
449
|
AFTER INSERT ON turns
|
|
450
450
|
BEGIN
|
|
451
451
|
UPDATE workspaces
|
|
452
|
-
SET
|
|
452
|
+
SET cost_usd = cost_usd + NEW.usage_cost_usd
|
|
453
453
|
WHERE id = (
|
|
454
454
|
SELECT r.workspace_id
|
|
455
455
|
FROM workers r
|
|
@@ -459,20 +459,20 @@ BEGIN
|
|
|
459
459
|
END;
|
|
460
460
|
|
|
461
461
|
CREATE TRIGGER IF NOT EXISTS turns_cost_rollup_update_worker
|
|
462
|
-
AFTER UPDATE OF
|
|
463
|
-
WHEN NEW.
|
|
462
|
+
AFTER UPDATE OF usage_cost_usd ON turns
|
|
463
|
+
WHEN NEW.usage_cost_usd != OLD.usage_cost_usd
|
|
464
464
|
BEGIN
|
|
465
465
|
UPDATE workers
|
|
466
|
-
SET
|
|
466
|
+
SET cost_usd = cost_usd + NEW.usage_cost_usd - OLD.usage_cost_usd
|
|
467
467
|
WHERE id = (SELECT worker_id FROM loops WHERE id = NEW.loop_id);
|
|
468
468
|
END;
|
|
469
469
|
|
|
470
470
|
CREATE TRIGGER IF NOT EXISTS turns_cost_rollup_update_workspace
|
|
471
|
-
AFTER UPDATE OF
|
|
472
|
-
WHEN NEW.
|
|
471
|
+
AFTER UPDATE OF usage_cost_usd ON turns
|
|
472
|
+
WHEN NEW.usage_cost_usd != OLD.usage_cost_usd
|
|
473
473
|
BEGIN
|
|
474
474
|
UPDATE workspaces
|
|
475
|
-
SET
|
|
475
|
+
SET cost_usd = cost_usd + NEW.usage_cost_usd - OLD.usage_cost_usd
|
|
476
476
|
WHERE id = (
|
|
477
477
|
SELECT r.workspace_id
|
|
478
478
|
FROM workers r
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plurnk/plurnk-service",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.6",
|
|
4
4
|
"description": "Plurnk agent runtime — the server / engine / core. Implements the @plurnk/plurnk-grammar contract.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -66,24 +66,21 @@
|
|
|
66
66
|
"prepack": "npm run build"
|
|
67
67
|
},
|
|
68
68
|
"dependencies": {
|
|
69
|
-
"@plurnk/gbnf": "1.3.
|
|
70
|
-
"@plurnk/plurnk-agui": "1.3.
|
|
71
|
-
"@plurnk/plurnk-execs": "1.3.
|
|
72
|
-
"@plurnk/plurnk-execs-common": "1.3.
|
|
73
|
-
"@plurnk/plurnk-execs-mcp": "1.3.
|
|
74
|
-
"@plurnk/plurnk-execs-search": "1.3.
|
|
75
|
-
"@plurnk/plurnk-grammar": "1.3.
|
|
76
|
-
"@plurnk/plurnk-meta": "1.3.
|
|
77
|
-
"@plurnk/plurnk-mimetypes": "1.3.
|
|
78
|
-
"@plurnk/plurnk-mimetypes-embeddings": "1.3.
|
|
79
|
-
"@plurnk/plurnk-mimetypes-text-html": "1.3.
|
|
80
|
-
"@plurnk/plurnk-
|
|
81
|
-
"@plurnk/plurnk-providers
|
|
82
|
-
"@plurnk/plurnk-
|
|
83
|
-
"@plurnk/plurnk-
|
|
84
|
-
"@plurnk/plurnk-providers-xai": "^1.2.0",
|
|
85
|
-
"@plurnk/plurnk-schemes": "1.3.4",
|
|
86
|
-
"@plurnk/plurnk-schemes-http": "1.3.4",
|
|
69
|
+
"@plurnk/gbnf": "1.3.6",
|
|
70
|
+
"@plurnk/plurnk-agui": "1.3.6",
|
|
71
|
+
"@plurnk/plurnk-execs": "1.3.6",
|
|
72
|
+
"@plurnk/plurnk-execs-common": "1.3.6",
|
|
73
|
+
"@plurnk/plurnk-execs-mcp": "1.3.6",
|
|
74
|
+
"@plurnk/plurnk-execs-search": "1.3.6",
|
|
75
|
+
"@plurnk/plurnk-grammar": "1.3.6",
|
|
76
|
+
"@plurnk/plurnk-meta": "1.3.6",
|
|
77
|
+
"@plurnk/plurnk-mimetypes": "1.3.6",
|
|
78
|
+
"@plurnk/plurnk-mimetypes-embeddings": "1.3.6",
|
|
79
|
+
"@plurnk/plurnk-mimetypes-text-html": "1.3.6",
|
|
80
|
+
"@plurnk/plurnk-models": "1.3.6",
|
|
81
|
+
"@plurnk/plurnk-providers": "1.3.6",
|
|
82
|
+
"@plurnk/plurnk-schemes": "1.3.6",
|
|
83
|
+
"@plurnk/plurnk-schemes-http": "1.3.6",
|
|
87
84
|
"@possumtech/sqlrite": "^6.5.2",
|
|
88
85
|
"diff": "^9.0.0",
|
|
89
86
|
"ignore": "7.0.6",
|