@plaiful/cli 0.16.3 → 0.17.1

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 (3) hide show
  1. package/README.md +3 -0
  2. package/package.json +22 -22
  3. package/src/cli.js +52 -1
package/README.md CHANGED
@@ -41,6 +41,7 @@ plaiful login
41
41
  | Tell HERMES your studio's strategy | `plaiful hermes strategy check`, then `plaiful hermes strategy publish` (your studio's admins) |
42
42
  | Run your studio's team | `plaiful studio show`, `plaiful studio invite <email> --role artist`, `plaiful studio remove <email>` (your studio's admins) |
43
43
  | Deploy and run worker agents | `plaiful agents deploy`, `plaiful agents run <name>` |
44
+ | Choose how often each agent job runs on its own | `plaiful ooda`, then `plaiful ooda set argo --cadence 24h` |
44
45
 
45
46
  Every load starts as a dry run: it shows what would change, and changes nothing until you add `--apply`.
46
47
 
@@ -106,6 +107,8 @@ plaiful agents batch crew-portrait --count 20 # start a batch (or a batch body
106
107
  plaiful agents status crew-portrait <jobId> # a batch's progress
107
108
  plaiful records import crew-portrait # dry run: records you wrote (resources/records/my-game/crew-portrait.json)
108
109
  # into the agent's table; --apply writes them, --no-render skips the art
110
+ plaiful ooda # when each agent's OODA jobs run on their own (the hourly tick)
111
+ plaiful ooda set argo --cadence 24h --window 02:00-06:00 # daily, only between 02:00 and 06:00 UTC
109
112
  plaiful lists # the product's SSM lists
110
113
  plaiful lists set shop_type tavern blacksmith healer # write one (lists get shop_type reads it)
111
114
  plaiful midas check # check docs/plaiful/my-game-midas-declaration.json (publish: plaiful midas publish; show)
package/package.json CHANGED
@@ -1,22 +1,22 @@
1
- {
2
- "name": "@plaiful/cli",
3
- "version": "0.16.3",
4
- "description": "The Plaiful CLI: work on your Plaiful product from your game repo, with no AWS access",
5
- "bin": {
6
- "plaiful": "bin/plaiful.js"
7
- },
8
- "files": [
9
- "bin",
10
- "src",
11
- "README.md",
12
- "LICENSE"
13
- ],
14
- "engines": {
15
- "node": ">=18"
16
- },
17
- "license": "Apache-2.0",
18
- "publishConfig": {
19
- "registry": "https://registry.npmjs.org/",
20
- "access": "public"
21
- }
22
- }
1
+ {
2
+ "name": "@plaiful/cli",
3
+ "version": "0.17.1",
4
+ "description": "The Plaiful CLI: work on your Plaiful product from your game repo, with no AWS access",
5
+ "bin": {
6
+ "plaiful": "bin/plaiful.js"
7
+ },
8
+ "files": [
9
+ "bin",
10
+ "src",
11
+ "README.md",
12
+ "LICENSE"
13
+ ],
14
+ "engines": {
15
+ "node": ">=18"
16
+ },
17
+ "license": "Apache-2.0",
18
+ "publishConfig": {
19
+ "registry": "https://registry.npmjs.org/",
20
+ "access": "public"
21
+ }
22
+ }
package/src/cli.js CHANGED
@@ -92,6 +92,10 @@ const HELP = `plaiful ${version}: work on your Plaiful product from your game re
92
92
  plaiful midas assess run MIDAS's analysis now
93
93
  plaiful midas wallet <player> one player's balances and recent earning / spending (wallet "platform")
94
94
  plaiful midas ledger check <file> would your game's report be accepted (wallet "game"): a dry run
95
+ plaiful ooda when each agent's OODA jobs run on their own for your game (the hourly tick)
96
+ plaiful ooda set <agent> [job] --cadence off|1h|6h|12h|24h|7d [--window HH:MM-HH:MM | --window any]
97
+ how often a job runs, and the UTC hours it may run in (HERMES's is your studio's:
98
+ sign in as one of its members)
95
99
  plaiful midas pricing what MIDAS pays per quest, in your reward kinds (delivered in each quest's rewards)
96
100
  plaiful midas pricing set <kind> --base <n> --per-effort <n> price a kind (either option alone keeps the other)
97
101
  plaiful midas pricing unset <kind> stop pricing a kind
@@ -193,7 +197,7 @@ function parse(argv) {
193
197
  for (let i = 0; i < argv.length; i += 1) {
194
198
  const a = argv[i];
195
199
  if (['--json', '--no-browser', '--help', '-h', '--version', '--apply', '--reset', '--rows', '--no-install', '--no-open', '--copies', '--no-render', '--wait', '--force', '--fountain', '--vo', '--all', '--retire', '--known', '--model', '--yes', '--dry-run', '--no-wait'].includes(a)) flags[a.replace(/^-+/, '')] = true;
196
- else if (['--product', '--api', '--dir', '--dest', '--count', '--base', '--per-effort', '--track', '--series', '--state', '--limit', '--section', '--since', '--note', '--out', '--style', '--aspect', '--frame', '--title', '--description', '--category', '--order', '--directives', '--narrative', '--hint', '--rarity', '--statement', '--name', '--reason', '--type', '--homeland', '--scope', '--status', '--steps', '--files', '--role', '--exclude', '--source', '--licence', '--releases', '--code', '--entry', '--data', '--snapshot', '--gpu', '--machine', '--hours', '--image', '--project', '--region', '--bucket', '--studio', '--products', '--before', '--to', '--into', '--games', '--caption'].includes(a)) {
200
+ else if (['--product', '--api', '--dir', '--dest', '--count', '--base', '--per-effort', '--track', '--series', '--state', '--limit', '--section', '--since', '--note', '--out', '--style', '--aspect', '--frame', '--title', '--description', '--category', '--order', '--directives', '--narrative', '--hint', '--rarity', '--statement', '--name', '--reason', '--type', '--homeland', '--scope', '--status', '--steps', '--files', '--role', '--exclude', '--source', '--licence', '--releases', '--code', '--entry', '--data', '--snapshot', '--gpu', '--machine', '--hours', '--image', '--project', '--region', '--bucket', '--studio', '--products', '--before', '--to', '--into', '--games', '--caption', '--cadence', '--window'].includes(a)) {
197
201
  if (argv[i + 1] === undefined) throw new UsageError(`${a} needs a value`);
198
202
  flags[a.slice(2)] = argv[i += 1];
199
203
  } else if (a === '--area') { // repeatable: --area art=edit --area content=view
@@ -1668,6 +1672,52 @@ async function midasPricing(ctx, [sub, name, value]) {
1668
1672
  return save(qp);
1669
1673
  }
1670
1674
 
1675
+ // ── OODA schedules (PLAI-232): when each agent's jobs run on their own, on the shared hourly tick ─────────────────
1676
+
1677
+ const oodaRoute = (r, rest = '') => `/partner/${encodeURIComponent(r.product)}/ooda${rest}`;
1678
+ const utc = (iso) => `${iso.slice(0, 16).replace('T', ' ')} UTC`;
1679
+ const jobLine = (a, j) => ` ${j.job.padEnd(14)} ${j.cadence_label}${j.quietWindow ? `, ${j.quietWindow.start}-${j.quietWindow.end} UTC` : ''}`
1680
+ + `${a.oodaEnabled && j.nextRunAt ? `; next about ${utc(j.nextRunAt)}` : ''}${j.lastTickAt ? `; last ${utc(j.lastTickAt)}` : ''}`;
1681
+
1682
+ async function ooda(ctx, [sub, agent, job]) {
1683
+ const r = repo(ctx);
1684
+ if (sub === 'set') return oodaSet(ctx, r, agent, job);
1685
+ if (sub) throw new UsageError(`plaiful ooda, or ooda set <agent> [job] --cadence <cadence> (not "${sub}")`);
1686
+ const { data } = await ctx.call('GET', oodaRoute(r));
1687
+ const lines = [`When ${r.product}'s agents run on their own in dev (the hourly tick; manual only = Assess Now):`];
1688
+ for (const a of data.agents) {
1689
+ lines.push(` ${a.agent}${a.scope_kind === 'studio' ? ' (your studio\'s)' : ''}: OODA ${a.oodaEnabled ? 'on' : 'off'}`);
1690
+ for (const j of a.jobs) lines.push(jobLine(a, j));
1691
+ }
1692
+ for (const n of data.notes || []) lines.push(` (${n})`);
1693
+ if (data.agents.some((a) => !a.oodaEnabled)) lines.push(' A job runs only while its agent\'s OODA is on (the OODA bar in the CMS).');
1694
+ ctx.out(lines.join('\n'), data);
1695
+ return 0;
1696
+ }
1697
+
1698
+ async function oodaSet(ctx, r, agent, job) {
1699
+ const usage = 'plaiful ooda set <agent> [job] --cadence off|1h|6h|12h|24h|7d [--window HH:MM-HH:MM | --window any]';
1700
+ if (!agent) throw new UsageError(usage);
1701
+ const body = {};
1702
+ if (ctx.flags.cadence !== undefined) body.cadence = String(ctx.flags.cadence);
1703
+ if (ctx.flags.window !== undefined) {
1704
+ const w = String(ctx.flags.window);
1705
+ const m = /^(\d\d:\d\d)-(\d\d:\d\d)$/.exec(w);
1706
+ if (w !== 'any' && !m) throw new UsageError('--window HH:MM-HH:MM (UTC), or --window any');
1707
+ body.quietWindow = m ? { start: m[1], end: m[2] } : null;
1708
+ }
1709
+ if (!Object.keys(body).length) throw new UsageError(usage);
1710
+ if (!job) {
1711
+ const { data } = await ctx.call('GET', oodaRoute(r));
1712
+ const a = data.agents.find((x) => x.agent === agent);
1713
+ if (a && a.jobs.length !== 1) throw new UsageError(`which job? ${agent} has ${a.jobs.map((j) => j.job).join(', ')}`);
1714
+ job = a ? a.jobs[0].job : 'assess';
1715
+ }
1716
+ const { data } = await ctx.call('PUT', oodaRoute(r, `/${encodeURIComponent(agent)}/${encodeURIComponent(job)}`), body);
1717
+ ctx.out([`${agent} ${data.label || job}: saved`, jobLine(data, data)].join('\n'), data);
1718
+ return 0;
1719
+ }
1720
+
1671
1721
  // ── Animation sets (SPRITE_ANIMATION.md §5) ─────────────────────────────────────────────────────────────────────
1672
1722
 
1673
1723
  const animationRoute = (r, rest = '') => `/partner/${encodeURIComponent(r.product)}/animation${rest}`;
@@ -2060,6 +2110,7 @@ const COMMANDS = {
2060
2110
  'midas assess': (ctx) => midasAssess(ctx),
2061
2111
  'midas wallet': (ctx, rest) => midasWallet(ctx, rest),
2062
2112
  'midas ledger': (ctx, rest) => midasLedger(ctx, rest),
2113
+ ooda: (ctx, rest) => ooda(ctx, rest),
2063
2114
  quests: (ctx, rest) => quests(ctx, rest),
2064
2115
  assets: (ctx, rest) => assets(ctx, rest),
2065
2116
  lore: (ctx, rest) => lore(ctx, rest),