@pome-sh/cli 0.43.1 → 0.44.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.
@@ -1,11 +1,8 @@
1
1
  import { seedSchema as seedSchema$2 } from './chunk-NBOQN5VX.js';
2
2
  import { seedSchema } from './chunk-YBWG5JK2.js';
3
- import { twinIdSchema } from './chunk-5KFDRR53.js';
3
+ import { twinIdSchema } from './chunk-7VZBAHQ2.js';
4
4
  import { seedSchema as seedSchema$1 } from './chunk-2K6BJ3PI.js';
5
5
  import { z } from 'zod';
6
- import { readFile, writeFile } from 'node:fs/promises';
7
- import { resolve, join, dirname } from 'node:path';
8
- import { stringify, parse } from 'yaml';
9
6
 
10
7
  var SLUG_RE = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
11
8
  var SLUG_MAX_LENGTH = 64;
@@ -978,6 +975,9 @@ z.object({
978
975
  trace_storage_key: z.string().optional(),
979
976
  state_initial_storage_key: z.string().optional(),
980
977
  state_final_storage_key: z.string().optional(),
978
+ // Compatibility-only: older CLI releases supplied this optional key. The
979
+ // current CLI no longer produces adapter signals, but the public request
980
+ // schema must continue to parse persisted/replayed finalize requests.
981
981
  signals_storage_key: z.string().optional(),
982
982
  // Multi-twin (M3): additive per-twin state storage keys, keyed by twin id.
983
983
  // Absent on single-twin sessions, which use the flat state_*_storage_key fields
@@ -1074,189 +1074,4 @@ z.object({
1074
1074
  })
1075
1075
  });
1076
1076
 
1077
- // src/hosted/errors.ts
1078
- var HostedAuthError = class extends Error {
1079
- constructor(message, requestId) {
1080
- super(message);
1081
- this.requestId = requestId;
1082
- this.name = "HostedAuthError";
1083
- }
1084
- requestId;
1085
- };
1086
- var HostedQuotaError = class extends Error {
1087
- /** `details` mirrors the cloud error envelope's machine-readable details
1088
- * (e.g. `{ kind: "daily_judge_cap" }`) so `pome demo` can
1089
- * render honest labeled at-capacity states. Optional: older responses and
1090
- * the twin-pod 401 shape carry none. */
1091
- constructor(message, requestId, details) {
1092
- super(message);
1093
- this.requestId = requestId;
1094
- this.details = details;
1095
- this.name = "HostedQuotaError";
1096
- }
1097
- requestId;
1098
- details;
1099
- };
1100
- var HostedOrchError = class extends Error {
1101
- /** `status` is the HTTP status that produced this error, when one exists
1102
- * (network/parse failures leave it undefined). `pome eval` uses it to
1103
- * scope its reaped-session retry to 404/410 only. */
1104
- constructor(message, requestId, status, type) {
1105
- super(message);
1106
- this.requestId = requestId;
1107
- this.status = status;
1108
- this.type = type;
1109
- this.name = "HostedOrchError";
1110
- }
1111
- requestId;
1112
- status;
1113
- type;
1114
- };
1115
- var HostedUsageError = class extends Error {
1116
- constructor(message) {
1117
- super(message);
1118
- this.name = "HostedUsageError";
1119
- }
1120
- };
1121
- var HostedTrialError = class extends Error {
1122
- constructor(message, errorCode) {
1123
- super(message);
1124
- this.errorCode = errorCode;
1125
- this.name = "HostedTrialError";
1126
- }
1127
- errorCode;
1128
- };
1129
- var HostedDiscardRefusedError = class extends Error {
1130
- constructor(message, sessionId, state, taskName, openSeconds, discardToken) {
1131
- super(message);
1132
- this.sessionId = sessionId;
1133
- this.state = state;
1134
- this.taskName = taskName;
1135
- this.openSeconds = openSeconds;
1136
- this.discardToken = discardToken;
1137
- this.name = "HostedDiscardRefusedError";
1138
- }
1139
- sessionId;
1140
- state;
1141
- taskName;
1142
- openSeconds;
1143
- discardToken;
1144
- };
1145
- function exitCodeFor(err) {
1146
- if (err instanceof HostedAuthError) return 3;
1147
- if (err instanceof HostedQuotaError) return 4;
1148
- if (err instanceof HostedUsageError) return 5;
1149
- if (err instanceof HostedDiscardRefusedError) return 5;
1150
- return 2;
1151
- }
1152
- var MANIFEST_JSON = "pome.json";
1153
- var MANIFEST_YAML = "pome.yaml";
1154
- var MANIFEST_YML = "pome.yml";
1155
- var MANIFEST_FILES = [MANIFEST_JSON, MANIFEST_YAML, MANIFEST_YML];
1156
- var SCHEMA_URL = "https://pome.sh/schemas/v1/pome.json";
1157
- var YAML_SCHEMA_COMMENT = `# yaml-language-server: $schema=${SCHEMA_URL}`;
1158
- function formatFor(fileName) {
1159
- return fileName === MANIFEST_JSON ? "json" : "yaml";
1160
- }
1161
- async function findManifestPath(startDir = process.cwd()) {
1162
- let dir = resolve(startDir);
1163
- for (; ; ) {
1164
- const present = [];
1165
- for (const fileName of MANIFEST_FILES) {
1166
- if (await fileExists(join(dir, fileName))) present.push(fileName);
1167
- }
1168
- if (present.length > 1) {
1169
- throw new HostedOrchError(
1170
- `Multiple pome manifests in ${dir}: ${present.join(", ")}. Keep exactly one (pome.json is canonical).`
1171
- );
1172
- }
1173
- if (present.length === 1) {
1174
- const fileName = present[0];
1175
- return { path: join(dir, fileName), format: formatFor(fileName) };
1176
- }
1177
- const parent = dirname(dir);
1178
- if (parent === dir) return null;
1179
- dir = parent;
1180
- }
1181
- }
1182
- async function readManifest(startDir = process.cwd()) {
1183
- const found = await findManifestPath(startDir);
1184
- if (!found) return null;
1185
- const text = await readFile(found.path, "utf8");
1186
- const raw = parseManifestText(text, found);
1187
- const manifest = validateManifest(raw, found.path);
1188
- return { ...found, manifest, raw };
1189
- }
1190
- async function readRequiredManifest(startDir = process.cwd()) {
1191
- const read = await readManifest(startDir);
1192
- if (!read) {
1193
- throw new HostedOrchError(
1194
- `No pome manifest found (${MANIFEST_JSON} or ${MANIFEST_YAML}). Run \`pome init\` first.`
1195
- );
1196
- }
1197
- return read;
1198
- }
1199
- async function writeManifest(path, format, data) {
1200
- if (format === "json") {
1201
- await writeFile(path, `${JSON.stringify(data, null, 2)}
1202
- `);
1203
- return;
1204
- }
1205
- const { $schema: _dropped, ...body } = data;
1206
- await writeFile(path, `${YAML_SCHEMA_COMMENT}
1207
- ${stringify(body)}`);
1208
- }
1209
- function parseManifestText(text, found) {
1210
- let parsed;
1211
- try {
1212
- parsed = found.format === "json" ? JSON.parse(text) : parse(text);
1213
- } catch (err) {
1214
- throw new HostedOrchError(
1215
- `${found.path} is not valid ${found.format.toUpperCase()}: ${err instanceof Error ? err.message : String(err)}`
1216
- );
1217
- }
1218
- if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
1219
- throw new HostedOrchError(`${found.path} is not a ${found.format} object`);
1220
- }
1221
- return parsed;
1222
- }
1223
- function validateManifest(raw, path) {
1224
- const result = manifestSchema.safeParse(raw);
1225
- if (result.success) return result.data;
1226
- const slugIssue = result.error.issues.find(
1227
- (issue) => issue.path[0] === "agent" && issue.path[1] === "slug"
1228
- );
1229
- if (slugIssue) {
1230
- throw new HostedOrchError(slugErrorMessage(raw, path));
1231
- }
1232
- const summary = result.error.issues.map((issue) => `${issue.path.join(".") || "(root)"}: ${issue.message}`).join("; ");
1233
- throw new HostedOrchError(`Invalid pome manifest ${path}: ${summary}`);
1234
- }
1235
- function slugErrorMessage(raw, path) {
1236
- const agent = typeof raw.agent === "object" && raw.agent !== null ? raw.agent : {};
1237
- const name = typeof agent.name === "string" ? agent.name : "";
1238
- const badSlug = typeof agent.slug === "string" ? agent.slug : "";
1239
- const suggestion = deriveAgentSlug(name || badSlug);
1240
- const base = `Invalid agent.slug in ${path}: must match ${SLUG_RE} (lowercase kebab-case, max 64 chars).`;
1241
- return suggestion.length > 0 ? `${base} Did you mean "${suggestion}"?` : base;
1242
- }
1243
- function normalizeManifestTwins(manifestTwins) {
1244
- if (manifestTwins === void 0) return void 0;
1245
- const out = /* @__PURE__ */ new Set();
1246
- for (const twin of manifestTwins) {
1247
- const norm = twin.trim().toLowerCase();
1248
- if (norm.length > 0) out.add(norm);
1249
- }
1250
- return out.size > 0 ? [...out] : void 0;
1251
- }
1252
- async function fileExists(path) {
1253
- try {
1254
- await readFile(path, "utf8");
1255
- return true;
1256
- } catch (err) {
1257
- if (err.code === "ENOENT") return false;
1258
- throw err;
1259
- }
1260
- }
1261
-
1262
- export { HostedAuthError, HostedDiscardRefusedError, HostedOrchError, HostedQuotaError, HostedTrialError, HostedUsageError, MANIFEST_JSON, MOUNTED_TWINS, agentResponseSchema, createEvalSessionResponseSchema, createSessionResponseSchema, criterionSchema, deriveAgentSlug, exitCodeFor, finalizeResponseSchema, findManifestPath, isMultiTwinSeedEnvelope, normalizeManifestTwins, normalizeTaskConfigKeys, readManifest, readRequiredManifest, sessionPublicSchema, submitResultResponseSchema, writeManifest };
1077
+ export { MOUNTED_TWINS, SLUG_RE, agentResponseSchema, createEvalSessionResponseSchema, createSessionResponseSchema, criterionSchema, deriveAgentSlug, finalizeResponseSchema, isMultiTwinSeedEnvelope, manifestSchema, normalizeTaskConfigKeys, sessionPublicSchema, submitResultResponseSchema };
@@ -39,7 +39,7 @@ var TWIN_REGISTRY = {
39
39
  defaultSeedState,
40
40
  GitHubDomain,
41
41
  openGitHubCloneDatabase
42
- } = await import('./src-G6CMFUR6.js');
42
+ } = await import('./src-252X4AEZ.js');
43
43
  const db = openGitHubCloneDatabase();
44
44
  const domain = new GitHubDomain(db);
45
45
  domain.seed(seedState === void 0 ? defaultSeedState() : seedState);
@@ -63,7 +63,7 @@ var TWIN_REGISTRY = {
63
63
  parseSeed: async (input) => (await import('./seed-SYJXLGWF.js')).parseSeed(input),
64
64
  seedFields: async () => Object.keys((await import('./seed-SYJXLGWF.js')).seedSchema.shape),
65
65
  async boot({ seedState, runId, recorder }) {
66
- const { createSlackTwinApp, openSlackTwinDatabase, SlackDomain } = await import('./src-SJDGRXC5.js');
66
+ const { createSlackTwinApp, openSlackTwinDatabase, SlackDomain } = await import('./src-LPTWNBO5.js');
67
67
  const db = openSlackTwinDatabase(":memory:");
68
68
  const domain = new SlackDomain(db);
69
69
  domain.applySeed(seedState);
@@ -90,8 +90,8 @@ var TWIN_REGISTRY = {
90
90
  parseSeed: async (input) => (await import('./seed-E6SA4NKZ.js')).parseSeed(input),
91
91
  seedFields: async () => Object.keys((await import('./seed-E6SA4NKZ.js')).seedSchema.shape),
92
92
  async boot({ seedState, runId, recorder, twinBaseUrl }) {
93
- const stripeTwin = await import('./src-VBXONWR3.js');
94
- const { createApp } = await import('./server-2WHSHTUD.js');
93
+ const stripeTwin = await import('./src-P5MEPJY4.js');
94
+ const { createApp } = await import('./server-GECKG2H6.js');
95
95
  const {
96
96
  applySeed: applyStripeSeed,
97
97
  createTwinStripeApp,
@@ -136,7 +136,7 @@ var TWIN_REGISTRY = {
136
136
  parseSeed: async (input) => (await import('./seed-W3R53GHH.js')).parseSeed(input),
137
137
  seedFields: async () => Object.keys((await import('./seed-W3R53GHH.js')).gmailSeedSchema.shape),
138
138
  async boot({ seedState, runId, recorder }) {
139
- const { createGmailTwinApp, GmailDomain, openGmailTwinDatabase, parseSeed } = await import('./src-DBOHIQNB.js');
139
+ const { createGmailTwinApp, GmailDomain, openGmailTwinDatabase, parseSeed } = await import('./src-CV7QDV5E.js');
140
140
  const db = openGmailTwinDatabase(":memory:");
141
141
  const seed = parseSeed(seedState);
142
142
  const domain = new GmailDomain(db);
@@ -165,7 +165,7 @@ var TWIN_REGISTRY = {
165
165
  LinearDomain,
166
166
  openLinearTwinDatabase,
167
167
  parseSeed
168
- } = await import('./src-FRPUTB2H.js');
168
+ } = await import('./src-D3PKLT54.js');
169
169
  const db = openLinearTwinDatabase(":memory:");
170
170
  const seed = parseSeed(seedState);
171
171
  const domain = new LinearDomain(db);
@@ -181,7 +181,7 @@ var TWIN_REGISTRY = {
181
181
  }
182
182
  };
183
183
  async function createGitHubSmokeApp() {
184
- const { createGitHubCloneApp } = await import('./src-G6CMFUR6.js');
184
+ const { createGitHubCloneApp } = await import('./src-252X4AEZ.js');
185
185
  return createGitHubCloneApp();
186
186
  }
187
187
  function defaultPortFor(twin, env = process.env) {
@@ -1,4 +1,4 @@
1
- import { isTwinName, TWIN_REGISTRY, TWIN_NAMES } from './chunk-4DXTT3RV.js';
1
+ import { isTwinName, TWIN_REGISTRY, TWIN_NAMES } from './chunk-RYAQ2ZYA.js';
2
2
  import { readFileSync } from 'node:fs';
3
3
  import { parse } from 'yaml';
4
4
 
@@ -1,14 +1,16 @@
1
- import { runTaskHosted, createHostedClient, parseTaskFile, resolveRunAgentIdentity, outcomeOf, isNarrated, criterionPhrase, narratorReadingLines } from './chunk-A6AM6KS4.js';
2
- import './chunk-GQSNU3YP.js';
1
+ import { runTaskHosted, createHostedClient, parseTaskFile, resolveRunAgentIdentity, outcomeOf, isNarrated, criterionPhrase, narratorReadingLines } from './chunk-G3YRDMBE.js';
2
+ import './chunk-ZVKPZHFQ.js';
3
+ import './chunk-4LQ4IJOC.js';
3
4
  import './chunk-NW7HGA2K.js';
4
5
  import './chunk-PASFBRK4.js';
5
6
  import './chunk-3FZY376K.js';
6
- import './chunk-4DXTT3RV.js';
7
- import { HostedQuotaError, HostedTrialError } from './chunk-CS7O2ZXB.js';
7
+ import './chunk-RYAQ2ZYA.js';
8
+ import { HostedQuotaError, HostedTrialError } from './chunk-26UAPLHK.js';
9
+ import './chunk-M7ATJ423.js';
8
10
  import './chunk-NBOQN5VX.js';
9
11
  import './chunk-YBWG5JK2.js';
10
12
  import './chunk-TWURH7YM.js';
11
- import './chunk-5KFDRR53.js';
13
+ import './chunk-7VZBAHQ2.js';
12
14
  import './chunk-SG6ZTIMT.js';
13
15
  import './chunk-2K6BJ3PI.js';
14
16
  import './chunk-FBSA5L36.js';
@@ -1,4 +1,4 @@
1
1
  export { POME_RECORDER_EVENTS_PATH, PROVIDER_SHAPED_TEAM_ID, TwinBootError, TwinError, UnknownToolError, bearerAuth, createAdminGate, createApp, createFileBackedRecorderStore, createRecorderHandle, createRecorderStore, created, ensureTwinAuthSecret, failureInjectionMiddleware, formTokenResolver, isLoopbackHost, mintProviderToken, ok, queryTokenResolver, recordedRequestHeaders, requireAdminAuth, resolveAuthSecret, resolveRecorderStore, serve, setClientIp, setRecordedTool, toTwinHttpEventRow, twinBuildInfo, verifyProviderToken } from './chunk-TWURH7YM.js';
2
- import './chunk-5KFDRR53.js';
2
+ import './chunk-7VZBAHQ2.js';
3
3
  export { redactEvent, redactSecrets } from './chunk-SG6ZTIMT.js';
4
4
  export { FAILURE_INJECTION_OVERRIDE_KEY, createFailureInjectionStore, failureInjectionRuleSchema } from './chunk-FBSA5L36.js';