@stackbone/cli 0.2.4 → 0.2.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/main.js +16139 -11165
- package/migrations/0022_trigger_subscriptions_mailbox.sql +19 -0
- package/migrations/0023_runs_waiting_status.sql +20 -0
- package/migrations/0024_browser_auth_profiles.sql +59 -0
- package/migrations/0025_trigger_subscriptions_mapping_graph.sql +9 -0
- package/package.json +2 -1
- package/runtime-deps/@stackbone/workflow-world/index.js +96 -67
- package/stackbone-cli-0.2.6.tgz +0 -0
- package/stackbone-cli-0.2.4.tgz +0 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
-- 0022_trigger_subscriptions_mailbox.sql — add mailbox column to trigger_subscriptions
|
|
2
|
+
-- The mailbox identifies which mailbox a mailbox-scoped trigger polls. When resolving
|
|
3
|
+
-- a declarative poll, the mailbox is injected into the arg the connector declares via
|
|
4
|
+
-- `mailboxParam` (e.g. Outlook app-only's `user-id`). Nullable for backward compatibility
|
|
5
|
+
-- with existing subscriptions.
|
|
6
|
+
|
|
7
|
+
ALTER TABLE stackbone_platform.trigger_subscriptions
|
|
8
|
+
ADD COLUMN mailbox text;
|
|
9
|
+
|
|
10
|
+
-- Last-resort integrity guard against a direct DB insert that skips the register
|
|
11
|
+
-- endpoint's validation. The SOURCE OF TRUTH for "this trigger needs a mailbox" is
|
|
12
|
+
-- the connector definition's `mailboxParam` (enforced by the poll engine + register
|
|
13
|
+
-- endpoint); SQL can't read that, so this constraint hardcodes today's only
|
|
14
|
+
-- mailbox-scoped connector. Adding another one means updating this constraint too.
|
|
15
|
+
ALTER TABLE stackbone_platform.trigger_subscriptions
|
|
16
|
+
ADD CONSTRAINT chk_outlook_app_only_requires_mailbox
|
|
17
|
+
CHECK (
|
|
18
|
+
(connector != 'outlook-app-only' OR mailbox IS NOT NULL)
|
|
19
|
+
);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
-- 0023_runs_waiting_status.sql — widen the runs status CHECK for serialized
|
|
2
|
+
-- (FIFO) execution (STA-104).
|
|
3
|
+
--
|
|
4
|
+
-- A serialized workflow trigger enqueued behind an active serial run is mirrored
|
|
5
|
+
-- into `stackbone_platform.runs` as a `waiting` row (started_at NULL — it has not
|
|
6
|
+
-- run yet) so both `stackbone dev` and the Studio runs view can surface the queue
|
|
7
|
+
-- read-only. When the FIFO gate admits the trigger and the next run starts, the
|
|
8
|
+
-- waiting row is cleared. The original CHECK (0001 listed
|
|
9
|
+
-- `running/done/failed/interrupted`) predates this value and would reject the
|
|
10
|
+
-- insert. Widen `runs_status_check` to match `runStatusSchema`.
|
|
11
|
+
--
|
|
12
|
+
-- No trigger change is needed: the existing pg_notify fan-out (0001
|
|
13
|
+
-- notify_run_event) already emits `run.created` on the waiting INSERT and
|
|
14
|
+
-- `run.started` on the started_at NULL→NOT-NULL transition when the run starts,
|
|
15
|
+
-- so open Studio views refresh through the existing SSE channel. Self-host and
|
|
16
|
+
-- cloud both run these migrations, so the behavior is identical.
|
|
17
|
+
ALTER TABLE stackbone_platform.runs DROP CONSTRAINT IF EXISTS runs_status_check;
|
|
18
|
+
ALTER TABLE stackbone_platform.runs
|
|
19
|
+
ADD CONSTRAINT runs_status_check
|
|
20
|
+
CHECK (status IN ('running', 'done', 'failed', 'interrupted', 'waiting'));
|
|
@@ -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;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stackbone/cli",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.6",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -37,6 +37,7 @@
|
|
|
37
37
|
"postgres": "^3.4.9",
|
|
38
38
|
"semver": "^7.7.4",
|
|
39
39
|
"tar": "^7.5.13",
|
|
40
|
+
"unpdf": "^0.12.1",
|
|
40
41
|
"yaml": "^2.8.3",
|
|
41
42
|
"zod": "^4.3.6"
|
|
42
43
|
}
|