oneie 4.0.1 → 4.0.2
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/package.json +1 -1
- package/dist/src/broadcast.js +2 -1
- package/dist/src/client.js +8 -2
- package/dist/src/links.js +2 -1
- package/dist/src/onboard.js +2 -1
- package/dist/src/push.js +3 -2
- package/dist/src/setup.js +2 -1
- package/dist/src/staff.js +3 -2
- package/dist/src/status.js +10 -4
- package/dist/src/substrate.js +2 -1
- package/package.json +1 -1
- package/dist/src/templates/_node/site/one.config.d.ts +0 -2
- package/dist/src/templates/_node/site/one.config.js +0 -22
package/dist/package.json
CHANGED
package/dist/src/broadcast.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { Command } from 'commander';
|
|
2
2
|
import { authHeaders, resolveBase } from './lib/client.js';
|
|
3
|
+
import { askPath } from './lib/api-path.js';
|
|
3
4
|
const DEFAULT_API = resolveBase({}, 'https://api.one.ie');
|
|
4
5
|
async function ask(api, receiver, data) {
|
|
5
|
-
const res = await fetch(
|
|
6
|
+
const res = await fetch(askPath(api.replace(/\/$/, ''), receiver), {
|
|
6
7
|
method: 'POST',
|
|
7
8
|
headers: authHeaders(),
|
|
8
9
|
body: JSON.stringify({ data }),
|
package/dist/src/client.js
CHANGED
|
@@ -29,7 +29,11 @@ async function ask(base, key, receiver, data) {
|
|
|
29
29
|
const body = await res.text().catch(() => '');
|
|
30
30
|
throw new Error(`${receiver} → ${res.status}\n${body}`);
|
|
31
31
|
}
|
|
32
|
-
|
|
32
|
+
const json = await res.json();
|
|
33
|
+
// Four-outcome envelope: unwrap { outcome, result } (bare shape passes through).
|
|
34
|
+
if (json.outcome === 'failure')
|
|
35
|
+
throw new Error(`${receiver} → failure: ${JSON.stringify(json.result ?? {})}`);
|
|
36
|
+
return (json.result ?? json);
|
|
33
37
|
}
|
|
34
38
|
export function clientCmd() {
|
|
35
39
|
const cmd = new Command('client').description('Manage client nodes');
|
|
@@ -62,7 +66,9 @@ export function clientCmd() {
|
|
|
62
66
|
process.stderr.write('AGENCY_SLUG missing — run `one setup` first\n');
|
|
63
67
|
process.exit(1);
|
|
64
68
|
}
|
|
65
|
-
|
|
69
|
+
// slug required for staff/owner keys — {} resolves the key's personal
|
|
70
|
+
// workspace and returns an empty portfolio.
|
|
71
|
+
const data = await ask(opts.api.replace(/\/$/, ''), key, 'billing:clients', { slug: agencySlug });
|
|
66
72
|
if (opts.json) {
|
|
67
73
|
process.stdout.write(JSON.stringify(data, null, 2) + '\n');
|
|
68
74
|
return;
|
package/dist/src/links.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { Command } from 'commander';
|
|
2
2
|
import { authHeaders, resolveBase } from './lib/client.js';
|
|
3
|
+
import { askPath } from './lib/api-path.js';
|
|
3
4
|
const DEFAULT_API = resolveBase({}, 'https://api.one.ie');
|
|
4
5
|
async function ask(api, receiver, data) {
|
|
5
|
-
const res = await fetch(
|
|
6
|
+
const res = await fetch(askPath(api.replace(/\/$/, ''), receiver), {
|
|
6
7
|
method: 'POST',
|
|
7
8
|
headers: authHeaders(),
|
|
8
9
|
body: JSON.stringify({ data }),
|
package/dist/src/onboard.js
CHANGED
|
@@ -17,6 +17,7 @@ import { writeFileSync, mkdirSync, renameSync, chmodSync } from 'node:fs';
|
|
|
17
17
|
import { resolve, join } from 'node:path';
|
|
18
18
|
import { homedir } from 'node:os';
|
|
19
19
|
import { mergeEnv, writeEnvLocal } from './env.js';
|
|
20
|
+
import { askPath } from './lib/api-path.js';
|
|
20
21
|
const DEFAULT_API = process.env.ONEIE_BASE_URL ?? process.env.ONE_API_URL ?? 'https://one.ie';
|
|
21
22
|
const CONFIG_DIR = resolve(homedir(), '.config', 'oneie');
|
|
22
23
|
const KEY_FILE = resolve(CONFIG_DIR, 'key');
|
|
@@ -28,7 +29,7 @@ function writeKey(value) {
|
|
|
28
29
|
renameSync(tmp, KEY_FILE);
|
|
29
30
|
}
|
|
30
31
|
async function ask(base, key, receiver, data) {
|
|
31
|
-
const res = await fetch(
|
|
32
|
+
const res = await fetch(askPath(base, receiver), {
|
|
32
33
|
method: 'POST',
|
|
33
34
|
headers: { 'Content-Type': 'application/json', ...(key ? { Authorization: `Bearer ${key}` } : {}) },
|
|
34
35
|
body: JSON.stringify({ data }),
|
package/dist/src/push.js
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { Command } from 'commander';
|
|
2
2
|
import { compileNode } from './compiler.js';
|
|
3
3
|
import { mergeEnv } from './env.js';
|
|
4
|
+
import { askPath } from './lib/api-path.js';
|
|
4
5
|
const DEFAULT_API = process.env.ONEIE_BASE_URL ?? process.env.ONE_API_URL ?? 'https://api.one.ie';
|
|
5
6
|
function apiKey(env) {
|
|
6
7
|
return env.ONEIE_API_KEY ?? env.ONE_API_KEY ?? process.env.ONEIE_API_KEY ?? process.env.ONE_API_KEY ?? '';
|
|
7
8
|
}
|
|
8
9
|
async function ask(base, headers, receiver, data) {
|
|
9
10
|
try {
|
|
10
|
-
const res = await fetch(
|
|
11
|
+
const res = await fetch(askPath(base, receiver), {
|
|
11
12
|
method: 'POST', headers, body: JSON.stringify({ data }),
|
|
12
13
|
});
|
|
13
14
|
if (!res.ok)
|
|
@@ -66,7 +67,7 @@ export function pushCmd() {
|
|
|
66
67
|
// Standard items (agents, skills, context, lifecycles, types …) — explicit-slug receivers
|
|
67
68
|
// authorize via the ownership walk, so the configured key covers owned child workspaces.
|
|
68
69
|
for (const item of compiled.filter((i) => !isWorkflow(i))) {
|
|
69
|
-
const res = await fetch(
|
|
70
|
+
const res = await fetch(askPath(base, item.receiver), {
|
|
70
71
|
method: 'POST', headers: authHeaders, body: JSON.stringify({ data: item.payload }),
|
|
71
72
|
});
|
|
72
73
|
if (res.ok)
|
package/dist/src/setup.js
CHANGED
|
@@ -2,10 +2,11 @@ import { Command } from 'commander';
|
|
|
2
2
|
import { existsSync, readFileSync, writeFileSync } from 'node:fs';
|
|
3
3
|
import { mergeEnv, writeEnvLocal } from './env.js';
|
|
4
4
|
import { readAgency } from './config.js';
|
|
5
|
+
import { askPath } from './lib/api-path.js';
|
|
5
6
|
const DEFAULT_API = process.env.ONEIE_BASE_URL ?? process.env.ONE_API_URL ?? 'https://api.one.ie';
|
|
6
7
|
const DEFAULT_WEB = process.env.ONEIE_BASE_URL ?? 'https://one.ie';
|
|
7
8
|
async function ask(base, key, receiver, data) {
|
|
8
|
-
const res = await fetch(
|
|
9
|
+
const res = await fetch(askPath(base, receiver), {
|
|
9
10
|
method: 'POST',
|
|
10
11
|
headers: { 'Content-Type': 'application/json', ...(key ? { Authorization: `Bearer ${key}` } : {}) },
|
|
11
12
|
body: JSON.stringify({ data }),
|
package/dist/src/staff.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Command } from 'commander';
|
|
2
2
|
import { authHeaders, out, resolveBase, resolveKey } from './lib/client.js';
|
|
3
|
+
import { askPath } from './lib/api-path.js';
|
|
3
4
|
const DEFAULT_API = resolveBase({}, 'https://one.ie');
|
|
4
5
|
const VALID_ROLES = ['owner', 'admin', 'member', 'viewer'];
|
|
5
6
|
export function staffCmd() {
|
|
@@ -32,7 +33,7 @@ export function staffCmd() {
|
|
|
32
33
|
body.email = email;
|
|
33
34
|
if (opts.workspace)
|
|
34
35
|
body.workspace = opts.workspace;
|
|
35
|
-
const res = await fetch(
|
|
36
|
+
const res = await fetch(askPath(base, 'world:invite-member'), {
|
|
36
37
|
method: 'POST',
|
|
37
38
|
headers: authHeaders({ key }),
|
|
38
39
|
body: JSON.stringify({ data: body }),
|
|
@@ -71,7 +72,7 @@ export function staffCmd() {
|
|
|
71
72
|
const body = { name, role };
|
|
72
73
|
if (opts.workspace)
|
|
73
74
|
body.workspace = opts.workspace;
|
|
74
|
-
const res = await fetch(
|
|
75
|
+
const res = await fetch(askPath(base, 'world:invite-agent'), {
|
|
75
76
|
method: 'POST',
|
|
76
77
|
headers: authHeaders({ key }),
|
|
77
78
|
body: JSON.stringify({ data: body }),
|
package/dist/src/status.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Command } from 'commander';
|
|
2
2
|
import { mergeEnv } from './env.js';
|
|
3
3
|
import { renderStatus } from './render.js';
|
|
4
|
+
import { askPath } from './lib/api-path.js';
|
|
4
5
|
const DEFAULT_API = process.env.ONEIE_BASE_URL ?? process.env.ONE_API_URL ?? 'https://one.ie';
|
|
5
6
|
export function statusCmd() {
|
|
6
7
|
return new Command('status')
|
|
@@ -17,10 +18,12 @@ export function statusCmd() {
|
|
|
17
18
|
process.exit(1);
|
|
18
19
|
}
|
|
19
20
|
const base = opts.api.replace(/\/$/, '');
|
|
20
|
-
|
|
21
|
+
// slug is required for staff/owner keys — without it the receiver resolves
|
|
22
|
+
// the key's personal workspace and returns an empty portfolio.
|
|
23
|
+
const res = await fetch(askPath(base, 'billing:clients'), {
|
|
21
24
|
method: 'POST',
|
|
22
25
|
headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${key}` },
|
|
23
|
-
body: JSON.stringify({ data: {} }),
|
|
26
|
+
body: JSON.stringify({ data: { slug: env.AGENCY_SLUG } }),
|
|
24
27
|
});
|
|
25
28
|
if (!res.ok) {
|
|
26
29
|
process.stderr.write(`billing:clients → ${res.status}\n`);
|
|
@@ -39,8 +42,11 @@ export function statusCmd() {
|
|
|
39
42
|
process.stdout.write(JSON.stringify(json, null, 2) + '\n');
|
|
40
43
|
return;
|
|
41
44
|
}
|
|
42
|
-
|
|
43
|
-
|
|
45
|
+
// Receiver replies in the four-outcome envelope: { outcome, result: { agency, clients } }.
|
|
46
|
+
// Unwrap it (keep the bare-shape fallback for older hosts).
|
|
47
|
+
const payload = (json.result ?? json);
|
|
48
|
+
const agency = (payload.agency ?? { slug: env.AGENCY_SLUG, name: env.AGENCY_NAME ?? null, markup_pct: 0, pool: 0, plan: 'free' });
|
|
49
|
+
const clients = (payload.clients ?? []);
|
|
44
50
|
process.stdout.write(renderStatus(agency, clients) + '\n');
|
|
45
51
|
});
|
|
46
52
|
}
|
package/dist/src/substrate.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { authHeaders, resolveBase } from './lib/client.js';
|
|
2
|
+
import { askPath } from './lib/api-path.js';
|
|
2
3
|
const DEFAULT_API = resolveBase({}, 'https://api.one.ie');
|
|
3
4
|
function base(opts) {
|
|
4
5
|
return resolveBase(opts, 'https://api.one.ie');
|
|
@@ -62,7 +63,7 @@ export function substrateCommands(program) {
|
|
|
62
63
|
data = parseJson(await readStdin(), '--data');
|
|
63
64
|
else if (opts.data)
|
|
64
65
|
data = parseJson(opts.data, '--data');
|
|
65
|
-
out(await api(
|
|
66
|
+
out(await api(askPath(base(opts), receiver), {
|
|
66
67
|
method: 'POST',
|
|
67
68
|
body: JSON.stringify({ data, timeoutMs: Number(opts.timeout) }),
|
|
68
69
|
}));
|
package/package.json
CHANGED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
// @ts-nocheck — template file; typechecked in the target Astro project, not the CLI
|
|
2
|
-
// Install: bun add @oneie/frontend
|
|
3
|
-
// After setup: copy ONE_API_KEY from .env.local into backend.apiKey
|
|
4
|
-
import { defineOne } from '@oneie/frontend';
|
|
5
|
-
// The only per-node configuration:
|
|
6
|
-
// - backend.apiKey: your workspace's scoped API key (from one setup)
|
|
7
|
-
// - brand.tokens: 6 color tokens to match your brand
|
|
8
|
-
export default defineOne({
|
|
9
|
-
backend: {
|
|
10
|
-
apiKey: process.env.ONE_API_KEY ?? '',
|
|
11
|
-
},
|
|
12
|
-
brand: {
|
|
13
|
-
tokens: {
|
|
14
|
-
primary: 'hsl(216 55% 25%)', // your brand primary
|
|
15
|
-
secondary: 'hsl(160 40% 45%)', // secondary / accent
|
|
16
|
-
tertiary: 'hsl(38 90% 55%)', // highlight / CTA
|
|
17
|
-
background: 'hsl(0 0% 100%)', // page background
|
|
18
|
-
foreground: 'hsl(220 20% 15%)', // body text
|
|
19
|
-
font: 'Inter, system-ui, sans-serif',
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
});
|