@stackbone/cli 0.2.5 → 0.2.7
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/CHANGELOG.md +30 -0
- package/main.js +25805 -21274
- package/migrations/0024_browser_auth_profiles.sql +59 -0
- package/migrations/0025_trigger_subscriptions_mapping_graph.sql +9 -0
- package/migrations/0026_trigger_subscriptions_correlation_key.sql +9 -0
- package/migrations/0027_trigger_deliveries_resumed_status.sql +19 -0
- package/package.json +3 -3
- package/stackbone-cli-0.2.7.tgz +0 -0
- package/stackbone-cli-0.2.5.tgz +0 -0
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
-- 0024_browser_auth_profiles.sql — persistent, encrypted browser auth profiles
|
|
2
|
+
-- for deep-agent browser tools (STA-99).
|
|
3
|
+
--
|
|
4
|
+
-- A browsing agent gets a fresh browser context per chat session, so it starts
|
|
5
|
+
-- logged out of every site every conversation. This table lets a successful
|
|
6
|
+
-- login be captured once and reused: the browser's serialized Playwright
|
|
7
|
+
-- `storageState` (cookies + per-origin localStorage) is encrypted and stored
|
|
8
|
+
-- keyed by (site origin, identity); every new browser context for that origin
|
|
9
|
+
-- starts with the state injected — already authenticated, no fresh login.
|
|
10
|
+
--
|
|
11
|
+
-- Rides the SAME secrets machinery as `stackbone_platform.secrets`, not a new
|
|
12
|
+
-- crypto path: it lives in the agent's OWN platform database (so scoping is
|
|
13
|
+
-- physical — a different install is a different DB + a different per-agent
|
|
14
|
+
-- `STACKBONE_SECRET_KEY`, and a row is unreachable/undecryptable from any other
|
|
15
|
+
-- install or org) and uses the identical `@stackbone/crypto` libsodium envelope
|
|
16
|
+
-- (`version` / `nonce` / `ciphertext`). Storage state is credential-equivalent
|
|
17
|
+
-- (a leaked cookie is a leaked password), which is exactly why it never sits in
|
|
18
|
+
-- plaintext and never leaves the install's database.
|
|
19
|
+
--
|
|
20
|
+
-- Identity model v1 is agent-owned: one identity per site per install (the
|
|
21
|
+
-- agent's own account). The `identity` column defaults to 'agent' and the
|
|
22
|
+
-- UNIQUE (origin, identity) key future-proofs per-identity profiles without a
|
|
23
|
+
-- rewrite when per-end-user identities arrive.
|
|
24
|
+
|
|
25
|
+
CREATE TABLE IF NOT EXISTS stackbone_platform.browser_auth_profiles (
|
|
26
|
+
id uuid PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
27
|
+
-- The site origin the profile authenticates, canonicalized to
|
|
28
|
+
-- `<scheme>://<host>[:<port>]` (e.g. `https://tutorbird.com`). The primary
|
|
29
|
+
-- half of the identity key.
|
|
30
|
+
origin text NOT NULL,
|
|
31
|
+
-- Which identity on that site this profile is for. v1 is always 'agent'
|
|
32
|
+
-- (the agent's own account); the column exists so per-end-user identities
|
|
33
|
+
-- are a non-breaking addition, never a rewrite.
|
|
34
|
+
identity text NOT NULL DEFAULT 'agent',
|
|
35
|
+
-- Crypto envelope, identical to `stackbone_platform.secrets`. The plaintext
|
|
36
|
+
-- is the JSON-serialized Playwright storageState; the cipher is the shared
|
|
37
|
+
-- libsodium `crypto_secretbox` keyed by the per-agent `STACKBONE_SECRET_KEY`.
|
|
38
|
+
version text NOT NULL DEFAULT 'v1' CHECK (version IN ('v1')),
|
|
39
|
+
nonce bytea NOT NULL,
|
|
40
|
+
ciphertext bytea NOT NULL,
|
|
41
|
+
-- Set when the agent landed unauthenticated despite an injected profile, so
|
|
42
|
+
-- exactly one re-login runs under the per-identity mutex and refreshes it.
|
|
43
|
+
stale boolean NOT NULL DEFAULT false,
|
|
44
|
+
created_at timestamptz NOT NULL DEFAULT now(),
|
|
45
|
+
updated_at timestamptz NOT NULL DEFAULT now()
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
-- One profile per (origin, identity): the login flow upserts on this key so a
|
|
49
|
+
-- re-login rotates the state in place rather than accumulating rows.
|
|
50
|
+
CREATE UNIQUE INDEX IF NOT EXISTS browser_auth_profiles_origin_identity_idx
|
|
51
|
+
ON stackbone_platform.browser_auth_profiles (origin, identity);
|
|
52
|
+
|
|
53
|
+
-- The operator list surface orders newest-first.
|
|
54
|
+
CREATE INDEX IF NOT EXISTS browser_auth_profiles_updated_at_idx
|
|
55
|
+
ON stackbone_platform.browser_auth_profiles (updated_at DESC);
|
|
56
|
+
|
|
57
|
+
-- Storage state is credential material — keep it out of reach of the read-only
|
|
58
|
+
-- SQL Explorer role exactly like `secrets` (0011).
|
|
59
|
+
REVOKE ALL ON stackbone_platform.browser_auth_profiles FROM stackbone_viewer;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
-- 0025_trigger_subscriptions_mapping_graph.sql — add mapping_graph column to trigger_subscriptions
|
|
2
|
+
-- The visual node editor authors an event→input mapping as a graph and COMPILES it to the
|
|
3
|
+
-- existing JSONata `mapping` string on the client. `mapping_graph` persists that graph opaquely
|
|
4
|
+
-- so the editor can re-open and keep editing; the runtime NEVER reads it (the forwarder still
|
|
5
|
+
-- evaluates only `mapping`). Nullable for backward compatibility and for code-mode detach, where
|
|
6
|
+
-- editing the raw JSONata clears the graph back to null.
|
|
7
|
+
|
|
8
|
+
ALTER TABLE stackbone_platform.trigger_subscriptions
|
|
9
|
+
ADD COLUMN IF NOT EXISTS mapping_graph jsonb;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
-- 0026_trigger_subscriptions_correlation_key.sql — add correlation_key column to trigger_subscriptions
|
|
2
|
+
-- A JSONata expression over the inbound event that produces a stable correlation key (typically the
|
|
3
|
+
-- email `threadId` / `conversationId`). When set, the forwarder derives the key from each event and
|
|
4
|
+
-- resumes the hook parked on that token instead of always starting a new run (resume-else-start).
|
|
5
|
+
-- This slice only STORES and PREVIEWS it — the runtime still ignores it — so it is inert and fully
|
|
6
|
+
-- backward compatible. Nullable: `null`/empty preserves today's start-only behavior.
|
|
7
|
+
|
|
8
|
+
ALTER TABLE stackbone_platform.trigger_subscriptions
|
|
9
|
+
ADD COLUMN IF NOT EXISTS correlation_key text;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
-- 0027_trigger_deliveries_resumed_status.sql — widen the delivery-journal status
|
|
2
|
+
-- CHECK for resume-else-start (STA-278 / STA-280).
|
|
3
|
+
--
|
|
4
|
+
-- The inbound forwarder used to be start-only: a delivery ended as `claimed`,
|
|
5
|
+
-- `started` or `rejected` (the inline CHECK from 0021). Resume-else-start adds a
|
|
6
|
+
-- fourth terminal outcome — `resumed` — when an inbound reply wakes a hook parked
|
|
7
|
+
-- on the link's correlation key instead of starting a brand-new run. Writing
|
|
8
|
+
-- `resumed` against the old CHECK throws a constraint violation (and the
|
|
9
|
+
-- forwarder's best-effort journal write would swallow it, leaving the row
|
|
10
|
+
-- mislabelled `claimed`). Widen the constraint to admit it.
|
|
11
|
+
--
|
|
12
|
+
-- The 0021 CHECK was declared INLINE (unnamed), so Postgres system-named it
|
|
13
|
+
-- `trigger_deliveries_status_check`. Drop that and re-add it including `resumed`.
|
|
14
|
+
-- Self-host and cloud both run these migrations, so the behavior is identical.
|
|
15
|
+
ALTER TABLE stackbone_platform.trigger_deliveries
|
|
16
|
+
DROP CONSTRAINT IF EXISTS trigger_deliveries_status_check;
|
|
17
|
+
ALTER TABLE stackbone_platform.trigger_deliveries
|
|
18
|
+
ADD CONSTRAINT trigger_deliveries_status_check
|
|
19
|
+
CHECK (status IN ('claimed', 'started', 'resumed', 'rejected'));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stackbone/cli",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.7",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -25,7 +25,6 @@
|
|
|
25
25
|
"cron-parser": "^4.9.0",
|
|
26
26
|
"drizzle-kit": "^0.31.10",
|
|
27
27
|
"drizzle-orm": "^0.45.2",
|
|
28
|
-
"esbuild": "^0.27.0",
|
|
29
28
|
"hono": "^4.12.15",
|
|
30
29
|
"libsodium-wrappers": "^0.8.4",
|
|
31
30
|
"open": "^11.0.0",
|
|
@@ -36,7 +35,8 @@
|
|
|
36
35
|
"pino-pretty": "^13.1.3",
|
|
37
36
|
"postgres": "^3.4.9",
|
|
38
37
|
"semver": "^7.7.4",
|
|
39
|
-
"
|
|
38
|
+
"unpdf": "^0.12.1",
|
|
39
|
+
"uuid": "^14.0.0",
|
|
40
40
|
"yaml": "^2.8.3",
|
|
41
41
|
"zod": "^4.3.6"
|
|
42
42
|
}
|
|
Binary file
|
package/stackbone-cli-0.2.5.tgz
DELETED
|
Binary file
|