@postplus/cli 0.1.40 → 0.1.41

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.
@@ -59,6 +59,13 @@ export async function runHostedDomainCommand(domain, args) {
59
59
  if (subcommand === 'schema') {
60
60
  return runHostedSchema(domain, rest);
61
61
  }
62
+ // Poll a pending async media-generation run by handle. This is a hand-coded
63
+ // branch (not a manifest verb) because a status poll has no endpointKey/field
64
+ // contract to project — exactly like the `research collect --run-handle`
65
+ // polling branch. It must be checked before the manifest verb dispatch.
66
+ if (domain === 'media' && subcommand === 'poll') {
67
+ return runMediaPoll(rest);
68
+ }
62
69
  if (domain === 'media' && subcommand && MEDIA_VERB_ENDPOINTS.has(subcommand)) {
63
70
  return runMediaVerb(subcommand, rest);
64
71
  }
@@ -456,6 +463,36 @@ function submitMediaGenerationRequest(params) {
456
463
  outputPath: params.outputPath,
457
464
  });
458
465
  }
466
+ // Poll a pending media-generation run: `postplus media poll --handle <run-id>`.
467
+ // A media `create`/`transcribe`/`analyze` submit returns an async run handle
468
+ // (`output.data.id`, also surfaced as `output.data.urls.get`) while the provider
469
+ // job is still processing. This resumes that run by handle against the
470
+ // media-generation `operation: 'status'` boundary. It is read-only and
471
+ // billing-idempotent: the Web boundary finds the run by handle and settlement
472
+ // reuses the submit's operationId, so polling never re-reserves or re-charges.
473
+ // The body carries only the status quadruple; submit-only fields (input,
474
+ // requestDimensions, quoteConfirmationToken) are never sent. Mirrors the
475
+ // `research collect --run-handle` polling branch.
476
+ async function runMediaPoll(args) {
477
+ const flags = parseFlags(args, new Set(['json']));
478
+ const handle = requireFlag(flags, 'handle');
479
+ const outputPath = flags.values.get('output') ?? null;
480
+ return runHostedCommand({
481
+ request: () => postHostedJson({
482
+ body: {
483
+ capability: 'media-generation',
484
+ handle,
485
+ operation: 'status',
486
+ operationId: `postplus-cli:media:media-generation:status:${randomUUID()}`,
487
+ },
488
+ pathName: '/api/postplus-cli/hosted/capability',
489
+ skillName: null,
490
+ }),
491
+ errorInputLabel: 'media-poll-handle',
492
+ json: flags.booleans.has('json'),
493
+ outputPath,
494
+ });
495
+ }
459
496
  function buildMediaVerbInput(input) {
460
497
  const record = {};
461
498
  for (const field of input.fields) {
@@ -970,7 +1007,8 @@ function printDomainVerbHelp(domain) {
970
1007
  const verbUsage = domain === 'media'
971
1008
  ? [...MEDIA_VERB_ENDPOINTS.keys()]
972
1009
  .map((verb) => ` postplus media ${verb} <endpoint-key> --<intent/default flags> [--json] [--output <result.json>]\n`)
973
- .join('')
1010
+ .join('') +
1011
+ ' postplus media poll --handle <run-id> [--json] [--output <result.json>]\n'
974
1012
  : ' postplus publish <operation> --request <input.json> [--json] [--output <result.json>]\n';
975
1013
  process.stdout.write(`PostPlus CLI - ${domain} commands
976
1014
 
package/build/index.js CHANGED
@@ -48,6 +48,7 @@ Usage:
48
48
  postplus research scrape <source-key> --request <input-array.json> [--skill <skill-id>] [--output <result.json>]
49
49
  postplus media schema [--endpoint <endpoint-key>] [--json]
50
50
  postplus media <verb> <endpoint-key> --request <input.json> | --<flags> [--output <result.json>]
51
+ postplus media poll --handle <run-id> [--json] [--output <result.json>]
51
52
  postplus media-file upload --input-file <path> [--mime <type>] [--skill <skill-id>] [--output <result.json>]
52
53
  postplus publish schema [--json]
53
54
  postplus publish <operation> --request <input.json> [--output <result.json>]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@postplus/cli",
3
- "version": "0.1.40",
3
+ "version": "0.1.41",
4
4
  "packageManager": "pnpm@10.30.3+sha512.c961d1e0a2d8e354ecaa5166b822516668b7f44cb5bd95122d590dd81922f606f5473b6d23ec4a5be05e7fcd18e8488d47d978bbe981872f1145d06e9a740017",
5
5
  "type": "module",
6
6
  "description": "PostPlus CLI for PostPlus Cloud auth, status, and diagnostics.",