@pome-sh/cli 0.26.13 → 0.27.0

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.
Files changed (34) hide show
  1. package/dist/build-info.json +3 -3
  2. package/dist/{checks-3LVRPHOK.js → checks-QM7QOJ6U.js} +2 -2
  3. package/dist/{chunk-NJ246QPJ.js → chunk-3T5XN64P.js} +35 -33
  4. package/dist/chunk-CF6EIU2U.js +51 -0
  5. package/dist/{chunk-ANKO3RCB.js → chunk-CTA54N4K.js} +5 -5
  6. package/dist/{chunk-CFXEETE3.js → chunk-E665XWYU.js} +2 -49
  7. package/dist/{chunk-IZIZC7ZW.js → chunk-G6GOCYIT.js} +23 -21
  8. package/dist/{chunk-QXQAVKTE.js → chunk-HJX25USP.js} +14 -1
  9. package/dist/{chunk-KIXYRPVY.js → chunk-IK2F7ZA3.js} +2 -2
  10. package/dist/{chunk-EIUCTFQV.js → chunk-JE4H5ODK.js} +16 -11
  11. package/dist/{chunk-6IVXTU67.js → chunk-MQE6DKIK.js} +4 -3
  12. package/dist/{chunk-FQGR7KDT.js → chunk-N74LP4QH.js} +2 -2
  13. package/dist/chunk-SLTBPJKZ.js +522 -0
  14. package/dist/chunk-ZDS25NS5.js +141 -0
  15. package/dist/{runDemo-XO5R5QTM.js → runDemo-O67ASC54.js} +11 -10
  16. package/dist/{runTrialGroup-CLJJOO4J.js → runTrialGroup-V3HB57YI.js} +9 -8
  17. package/dist/seed-3ZTWKLBE.js +1 -0
  18. package/dist/seed-BG5HMSBM.js +1 -0
  19. package/dist/seed-IIMBJHAJ.js +1 -0
  20. package/dist/seed-NR6RUKXV.js +1 -0
  21. package/dist/seed-YWDTT2WL.js +2 -0
  22. package/dist/server-DMLORMOV.js +4 -0
  23. package/dist/src/cli/main.js +32 -22
  24. package/dist/{src-JJNS46T6.js → src-56Y2R7ZQ.js} +4 -3
  25. package/dist/{src-Q4JNJE5S.js → src-JRBHNT4Y.js} +4 -3
  26. package/dist/{src-GWA7QVQS.js → src-KSLAF3I4.js} +4 -3
  27. package/dist/{src-FXRQSKBK.js → src-PW7U25ZX.js} +6 -518
  28. package/dist/{src-L6F5YXSP.js → src-SKCWAMVQ.js} +5 -138
  29. package/dist/twinHarness-YOVJR72F.js +6 -0
  30. package/dist/{twinStart-WIT4UVAC.js → twinStart-PDL53BY5.js} +58 -5
  31. package/package.json +1 -1
  32. package/dist/server-TK5YBK6E.js +0 -3
  33. package/dist/twinHarness-6NVAKIOB.js +0 -5
  34. package/dist/{run-CFA4LZWQ.js → run-WONFTZS3.js} +1 -1
@@ -0,0 +1,6 @@
1
+ export { UnsupportedTwinError, bootTwin } from './chunk-IK2F7ZA3.js';
2
+ export { STRIPE_LOCAL_ACCOUNT_ID } from './chunk-JE4H5ODK.js';
3
+ import './chunk-E665XWYU.js';
4
+ import './chunk-6KJC4BTO.js';
5
+ import './chunk-SG6ZTIMT.js';
6
+ import './chunk-CF6EIU2U.js';
@@ -1,14 +1,16 @@
1
- import { bootTwin } from './chunk-KIXYRPVY.js';
2
- import { isTwinName, TWIN_NAMES, defaultPortFor, TWIN_REGISTRY } from './chunk-EIUCTFQV.js';
3
- import './chunk-CFXEETE3.js';
1
+ import { bootTwin } from './chunk-IK2F7ZA3.js';
2
+ import { TWIN_REGISTRY, isTwinName, TWIN_NAMES, defaultPortFor } from './chunk-JE4H5ODK.js';
3
+ import './chunk-E665XWYU.js';
4
4
  import './chunk-6KJC4BTO.js';
5
5
  import './chunk-SG6ZTIMT.js';
6
+ import './chunk-CF6EIU2U.js';
6
7
  import { randomBytes } from 'node:crypto';
7
8
  import { readFileSync } from 'node:fs';
8
9
  import { mkdir, writeFile } from 'node:fs/promises';
9
10
  import { join } from 'node:path';
10
11
  import { serve } from '@hono/node-server';
11
12
  import { sign } from 'hono/jwt';
13
+ import { parse } from 'yaml';
12
14
 
13
15
  var STANDALONE_SID = "standalone";
14
16
  function resolveStandaloneAuthSecret(twin, env = process.env) {
@@ -33,6 +35,49 @@ function resolveStandaloneAuthSecret(twin, env = process.env) {
33
35
  }
34
36
  return { secret: randomBytes(32).toString("hex"), source: "ephemeral" };
35
37
  }
38
+ async function resolveStandaloneSeed(twin, seedPath, env = process.env) {
39
+ const entry = TWIN_REGISTRY[twin];
40
+ if (seedPath !== void 0) {
41
+ let raw;
42
+ try {
43
+ raw = readFileSync(seedPath, "utf8");
44
+ } catch (err) {
45
+ throw new Error(
46
+ `pome twin start --seed: cannot read ${seedPath}: ${err.message}`
47
+ );
48
+ }
49
+ return {
50
+ seedState: await parseWorld(entry, raw, `--seed ${seedPath}`),
51
+ source: "file",
52
+ path: seedPath
53
+ };
54
+ }
55
+ const fromEnv = env.POME_SEED_JSON;
56
+ if (fromEnv !== void 0 && fromEnv !== "") {
57
+ return { seedState: await parseWorld(entry, fromEnv, "POME_SEED_JSON"), source: "env" };
58
+ }
59
+ return { seedState: await entry.defaultSeed(), source: "default" };
60
+ }
61
+ function stripSidecarMeta(seed) {
62
+ if (seed && typeof seed === "object" && !Array.isArray(seed)) {
63
+ const { _meta, ...rest } = seed;
64
+ return rest;
65
+ }
66
+ return seed;
67
+ }
68
+ async function parseWorld(entry, raw, origin) {
69
+ let parsed;
70
+ try {
71
+ parsed = parse(raw);
72
+ } catch (err) {
73
+ throw new Error(`${origin} is not valid JSON or YAML: ${err.message}`);
74
+ }
75
+ try {
76
+ return await entry.parseSeed(stripSidecarMeta(parsed));
77
+ } catch (err) {
78
+ throw new Error(`${origin} is not a world this twin can boot: ${err.message}`);
79
+ }
80
+ }
36
81
  async function runTwinStartCommand(name, options) {
37
82
  if (!isTwinName(name)) {
38
83
  throw new Error(`Unknown twin '${name}'. Supported: ${TWIN_NAMES.join(", ")}.`);
@@ -42,12 +87,13 @@ async function runTwinStartCommand(name, options) {
42
87
  if (!Number.isInteger(port) || port < 1 || port > 65535) {
43
88
  throw new Error(`pome twin start: invalid --port "${portRaw}"`);
44
89
  }
90
+ const world = await resolveStandaloneSeed(name, options.seed);
45
91
  const resolved = resolveStandaloneAuthSecret(name);
46
92
  process.env.TWIN_AUTH_SECRET = resolved.secret;
47
93
  const baseUrl = `http://127.0.0.1:${port}`;
48
94
  const harness = await bootTwin({
49
95
  twin: name,
50
- seedState: await TWIN_REGISTRY[name].defaultSeed(),
96
+ seedState: world.seedState,
51
97
  runId: STANDALONE_SID,
52
98
  twinBaseUrl: baseUrl
53
99
  });
@@ -83,6 +129,13 @@ async function runTwinStartCommand(name, options) {
83
129
  throw err;
84
130
  }
85
131
  console.log(`Pome ${name} twin listening at ${restUrl}`);
132
+ if (world.source === "file") {
133
+ console.log(`World: seeded from ${world.path}.`);
134
+ } else if (world.source === "env") {
135
+ console.log("World: seeded from POME_SEED_JSON (--seed <path> overrides it).");
136
+ } else {
137
+ console.log(`World: the ${name} twin's default (pass --seed <path> for your own).`);
138
+ }
86
139
  if (resolved.source === "persisted") {
87
140
  console.log(
88
141
  `Auth: using the persisted secret from ${resolved.path} (an env-injected TWIN_AUTH_SECRET overrides it).`
@@ -108,4 +161,4 @@ async function runTwinStartCommand(name, options) {
108
161
  process.once("SIGTERM", shutdown);
109
162
  }
110
163
 
111
- export { resolveStandaloneAuthSecret, runTwinStartCommand };
164
+ export { resolveStandaloneAuthSecret, resolveStandaloneSeed, runTwinStartCommand };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pome-sh/cli",
3
- "version": "0.26.13",
3
+ "version": "0.27.0",
4
4
  "description": "Digital-twin testing for AI agents \u2014 run tasks against resettable local or hosted twins and record tool-call traces for evaluation on pome.sh.",
5
5
  "keywords": [
6
6
  "ai",
@@ -1,3 +0,0 @@
1
- export { FAILURE_INJECTION_OVERRIDE_KEY, POME_RECORDER_EVENTS_PATH, PROVIDER_SHAPED_TEAM_ID, TwinBootError, TwinError, UnknownToolError, bearerAuth, createAdminGate, createApp, createFailureInjectionStore, createFileBackedRecorderStore, createRecorderHandle, createRecorderStore, created, ensureTwinAuthSecret, failureInjectionMiddleware, failureInjectionRuleSchema, formTokenResolver, isLoopbackHost, mintProviderToken, ok, queryTokenResolver, recordedRequestHeaders, requireAdminAuth, resolveAuthSecret, resolveRecorderStore, serve, setClientIp, setRecordedTool, toTwinHttpEventRow, twinBuildInfo, verifyProviderToken } from './chunk-CFXEETE3.js';
2
- import './chunk-6KJC4BTO.js';
3
- export { redactEvent, redactSecrets } from './chunk-SG6ZTIMT.js';
@@ -1,5 +0,0 @@
1
- export { UnsupportedTwinError, bootTwin } from './chunk-KIXYRPVY.js';
2
- export { STRIPE_LOCAL_ACCOUNT_ID } from './chunk-EIUCTFQV.js';
3
- import './chunk-CFXEETE3.js';
4
- import './chunk-6KJC4BTO.js';
5
- import './chunk-SG6ZTIMT.js';
@@ -1,5 +1,5 @@
1
- import { isHostAllowed } from './chunk-CBFKZZBR.js';
2
1
  import './chunk-NW7HGA2K.js';
2
+ import { isHostAllowed } from './chunk-CBFKZZBR.js';
3
3
  import { redactEvent } from './chunk-SG6ZTIMT.js';
4
4
  import { resolve, dirname } from 'node:path';
5
5
  import { randomUUID } from 'node:crypto';