deepline 0.1.65 → 0.1.67
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/cli/index.js +385 -2
- package/dist/cli/index.mjs +385 -2
- package/dist/index.d.mts +78 -0
- package/dist/index.d.ts +78 -0
- package/dist/index.js +60 -2
- package/dist/index.mjs +60 -2
- package/dist/repo/apps/play-runner-workers/src/coordinator-entry.ts +475 -69
- package/dist/repo/apps/play-runner-workers/src/dedup-do.ts +134 -0
- package/dist/repo/apps/play-runner-workers/src/entry.ts +37 -49
- package/dist/repo/apps/play-runner-workers/src/runtime/harness-receipt-store.ts +13 -0
- package/dist/repo/apps/play-runner-workers/src/runtime/receipts.ts +10 -136
- package/dist/repo/sdk/src/client.ts +73 -0
- package/dist/repo/sdk/src/http.ts +9 -1
- package/dist/repo/sdk/src/plays/harness-stub.ts +4 -0
- package/dist/repo/sdk/src/release.ts +2 -2
- package/dist/repo/sdk/src/types.ts +59 -0
- package/dist/repo/shared_libs/play-runtime/db-session-crypto.ts +312 -0
- package/dist/repo/shared_libs/play-runtime/db-session-plan.ts +69 -0
- package/dist/repo/shared_libs/play-runtime/db-session.ts +439 -0
- package/dist/repo/shared_libs/play-runtime/work-receipts.ts +92 -0
- package/package.json +1 -1
package/dist/cli/index.mjs
CHANGED
|
@@ -206,10 +206,10 @@ import { join as join2 } from "path";
|
|
|
206
206
|
|
|
207
207
|
// src/release.ts
|
|
208
208
|
var SDK_RELEASE = {
|
|
209
|
-
version: "0.1.
|
|
209
|
+
version: "0.1.67",
|
|
210
210
|
apiContract: "2026-05-play-bootstrap-dataset-summary",
|
|
211
211
|
supportPolicy: {
|
|
212
|
-
latest: "0.1.
|
|
212
|
+
latest: "0.1.67",
|
|
213
213
|
minimumSupported: "0.1.53",
|
|
214
214
|
deprecatedBelow: "0.1.53"
|
|
215
215
|
}
|
|
@@ -460,6 +460,9 @@ var HttpClient = class {
|
|
|
460
460
|
headers
|
|
461
461
|
});
|
|
462
462
|
}
|
|
463
|
+
async patch(path, body, headers) {
|
|
464
|
+
return this.request(path, { method: "PATCH", body, headers });
|
|
465
|
+
}
|
|
463
466
|
/**
|
|
464
467
|
* Send a DELETE request.
|
|
465
468
|
*
|
|
@@ -1583,6 +1586,61 @@ var DeeplineClient = class {
|
|
|
1583
1586
|
return this.http.delete(`/api/v2/plays/${encodedName}`);
|
|
1584
1587
|
}
|
|
1585
1588
|
// ——————————————————————————————————————————————————————————
|
|
1589
|
+
// Plays — public share pages
|
|
1590
|
+
// ——————————————————————————————————————————————————————————
|
|
1591
|
+
/**
|
|
1592
|
+
* Current share status for a play: the public page (if any), the published
|
|
1593
|
+
* copy, and the revision picker. Read-only.
|
|
1594
|
+
*/
|
|
1595
|
+
async getSharePage(name) {
|
|
1596
|
+
const encodedName = encodeURIComponent(name);
|
|
1597
|
+
return this.http.get(`/api/v2/plays/${encodedName}/share`);
|
|
1598
|
+
}
|
|
1599
|
+
/**
|
|
1600
|
+
* Publish (or repoint) the play's public share page to a revision. Requires
|
|
1601
|
+
* `acknowledgedUnlisted: true` — the page is publicly viewable. Org-admin only.
|
|
1602
|
+
*/
|
|
1603
|
+
async publishSharePage(name, request) {
|
|
1604
|
+
const encodedName = encodeURIComponent(name);
|
|
1605
|
+
return this.http.post(
|
|
1606
|
+
`/api/v2/plays/${encodedName}/share`,
|
|
1607
|
+
request
|
|
1608
|
+
);
|
|
1609
|
+
}
|
|
1610
|
+
/**
|
|
1611
|
+
* Update share-page settings (SEO indexing, credit-cost / latency display)
|
|
1612
|
+
* without moving the published pointer. Org-admin only.
|
|
1613
|
+
*/
|
|
1614
|
+
async updateSharePage(name, request) {
|
|
1615
|
+
const encodedName = encodeURIComponent(name);
|
|
1616
|
+
return this.http.patch(
|
|
1617
|
+
`/api/v2/plays/${encodedName}/share`,
|
|
1618
|
+
request
|
|
1619
|
+
);
|
|
1620
|
+
}
|
|
1621
|
+
/**
|
|
1622
|
+
* Unshare: hard-delete the play's public page and its cards. Returns the
|
|
1623
|
+
* fresh status (now `share: null`). Org-admin only. Idempotent — a no-op when
|
|
1624
|
+
* the play was never published.
|
|
1625
|
+
*/
|
|
1626
|
+
async unpublishSharePage(name) {
|
|
1627
|
+
const encodedName = encodeURIComponent(name);
|
|
1628
|
+
return this.http.delete(
|
|
1629
|
+
`/api/v2/plays/${encodedName}/share`
|
|
1630
|
+
);
|
|
1631
|
+
}
|
|
1632
|
+
/**
|
|
1633
|
+
* Regenerate the LLM landing-page copy for a revision (defaults to the
|
|
1634
|
+
* published one). Org-admin only.
|
|
1635
|
+
*/
|
|
1636
|
+
async regenerateSharePage(name, request = {}) {
|
|
1637
|
+
const encodedName = encodeURIComponent(name);
|
|
1638
|
+
return this.http.post(
|
|
1639
|
+
`/api/v2/plays/${encodedName}/share/regenerate`,
|
|
1640
|
+
request
|
|
1641
|
+
);
|
|
1642
|
+
}
|
|
1643
|
+
// ——————————————————————————————————————————————————————————
|
|
1586
1644
|
// Plays — high-level orchestration
|
|
1587
1645
|
// ——————————————————————————————————————————————————————————
|
|
1588
1646
|
/**
|
|
@@ -12099,6 +12157,331 @@ Examples:
|
|
|
12099
12157
|
...options.json ? ["--json"] : []
|
|
12100
12158
|
]);
|
|
12101
12159
|
});
|
|
12160
|
+
const share = play.command("share").description(
|
|
12161
|
+
"Manage a play's public, unlisted share page (advanced \u2014 exposes play code)."
|
|
12162
|
+
).addHelpText(
|
|
12163
|
+
"after",
|
|
12164
|
+
`
|
|
12165
|
+
Concepts:
|
|
12166
|
+
A share page is a public, unlisted, SEO-indexable landing page for a play,
|
|
12167
|
+
pinned to one revision. Publish only after the play has run successfully.
|
|
12168
|
+
|
|
12169
|
+
NOT RECOMMENDED by default. Only publish when the user has explicitly asked
|
|
12170
|
+
to share this play AND has confirmed they accept the risks below. When in
|
|
12171
|
+
doubt, leave the play unpublished.
|
|
12172
|
+
|
|
12173
|
+
What is exposed:
|
|
12174
|
+
Run results and row-level data are NEVER exposed. But the page renders the
|
|
12175
|
+
play's STRUCTURE and anything baked into its source code: step names,
|
|
12176
|
+
input/output field names, tool ids, step descriptions/prompts, and any
|
|
12177
|
+
hardcoded string literals or comments in the play file. If the source
|
|
12178
|
+
contains PII, internal domains/emails, secrets-by-mistake, or proprietary
|
|
12179
|
+
business logic, publishing makes it publicly viewable and search-indexable.
|
|
12180
|
+
|
|
12181
|
+
Review the play source for sensitive content before publishing. Use
|
|
12182
|
+
--seo noindex to keep the page out of search engines if you must share it.
|
|
12183
|
+
|
|
12184
|
+
Examples:
|
|
12185
|
+
deepline plays share status company-to-contact --json
|
|
12186
|
+
deepline plays share publish company-to-contact --yes
|
|
12187
|
+
deepline plays share publish company-to-contact --version 3 --seo noindex --yes
|
|
12188
|
+
deepline plays share update company-to-contact --show-latency --json
|
|
12189
|
+
deepline plays share regenerate company-to-contact --json
|
|
12190
|
+
deepline plays share unpublish company-to-contact --yes
|
|
12191
|
+
`
|
|
12192
|
+
);
|
|
12193
|
+
share.command("status <play>").description("Show a play's share-page status and revision picker.").option("--json", "Emit JSON output. Also automatic when stdout is piped").action(async (playName, options) => {
|
|
12194
|
+
process.exitCode = await handlePlayShareStatus([
|
|
12195
|
+
playName,
|
|
12196
|
+
...options.json ? ["--json"] : []
|
|
12197
|
+
]);
|
|
12198
|
+
});
|
|
12199
|
+
share.command("publish <play>").description(
|
|
12200
|
+
"Publish/repoint a PUBLIC page to a revision. Advanced; not recommended unless explicitly requested and risks confirmed."
|
|
12201
|
+
).option("--latest", "Publish the newest revision (default).").option("--version <n>", "Publish a specific version number.").option("--revision-id <id>", "Publish a specific revision id.").option("--seo <mode>", "SEO indexing: index | noindex.").option("--show-cost", "Show average Deepline credit cost on the page.").option("--show-latency", "Show average latency on the page.").option("--no-run-check", 'Skip the "must have a completed run" gate.').option(
|
|
12202
|
+
"-y, --yes",
|
|
12203
|
+
"Confirm public exposure of the play code/structure (required)."
|
|
12204
|
+
).option("--dry-run", "Show the planned publish without writing.").option("--json", "Emit JSON output. Also automatic when stdout is piped").addHelpText(
|
|
12205
|
+
"after",
|
|
12206
|
+
`
|
|
12207
|
+
WARNING \u2014 not recommended by default.
|
|
12208
|
+
Only run when the user has explicitly asked to share this play AND has
|
|
12209
|
+
confirmed they accept the exposure risks. Otherwise, do not publish.
|
|
12210
|
+
|
|
12211
|
+
Mutates cloud state. Creates a PUBLIC, SEO-indexable (unless --seo noindex),
|
|
12212
|
+
unlisted page; requires --yes to acknowledge it is publicly viewable.
|
|
12213
|
+
|
|
12214
|
+
Run results and row data are NEVER exposed. The page DOES expose the play's
|
|
12215
|
+
code/structure: step names, input/output field names, tool ids, step
|
|
12216
|
+
descriptions/prompts, and any hardcoded literals or comments in the source.
|
|
12217
|
+
This may reveal PII, internal domains/emails, or proprietary logic if such
|
|
12218
|
+
content lives in the play file. Review the source before publishing.
|
|
12219
|
+
|
|
12220
|
+
Exit codes: 0 ok; 2 usage/missing --yes; 4 play or version not found;
|
|
12221
|
+
7 no successful run for the play.
|
|
12222
|
+
|
|
12223
|
+
Examples:
|
|
12224
|
+
deepline plays share publish company-to-contact --yes
|
|
12225
|
+
deepline plays share publish company-to-contact --version 3 --seo noindex --yes --json
|
|
12226
|
+
`
|
|
12227
|
+
).action(async (playName, options) => {
|
|
12228
|
+
process.exitCode = await handlePlaySharePublish([
|
|
12229
|
+
playName,
|
|
12230
|
+
...options.latest ? ["--latest"] : [],
|
|
12231
|
+
...options.version ? ["--version", String(options.version)] : [],
|
|
12232
|
+
...options.revisionId ? ["--revision-id", options.revisionId] : [],
|
|
12233
|
+
...options.seo ? ["--seo", options.seo] : [],
|
|
12234
|
+
...options.showCost ? ["--show-cost"] : [],
|
|
12235
|
+
...options.showLatency ? ["--show-latency"] : [],
|
|
12236
|
+
...options.runCheck === false ? ["--no-run-check"] : [],
|
|
12237
|
+
...options.yes ? ["--yes"] : [],
|
|
12238
|
+
...options.dryRun ? ["--dry-run"] : [],
|
|
12239
|
+
...options.json ? ["--json"] : []
|
|
12240
|
+
]);
|
|
12241
|
+
});
|
|
12242
|
+
share.command("update <play>").description("Update share-page settings without moving the pointer.").option("--seo <mode>", "SEO indexing: index | noindex.").option("--show-cost", "Show average Deepline credit cost.").option("--hide-cost", "Hide average Deepline credit cost.").option("--show-latency", "Show average latency.").option("--hide-latency", "Hide average latency.").option("--json", "Emit JSON output. Also automatic when stdout is piped").action(async (playName, options) => {
|
|
12243
|
+
process.exitCode = await handlePlayShareUpdate([
|
|
12244
|
+
playName,
|
|
12245
|
+
...options.seo ? ["--seo", options.seo] : [],
|
|
12246
|
+
...options.showCost ? ["--show-cost"] : [],
|
|
12247
|
+
...options.hideCost ? ["--hide-cost"] : [],
|
|
12248
|
+
...options.showLatency ? ["--show-latency"] : [],
|
|
12249
|
+
...options.hideLatency ? ["--hide-latency"] : [],
|
|
12250
|
+
...options.json ? ["--json"] : []
|
|
12251
|
+
]);
|
|
12252
|
+
});
|
|
12253
|
+
share.command("regenerate <play>").description("Regenerate the public page's LLM copy for a revision.").option("--version <n>", "Regenerate a specific version number.").option("--revision-id <id>", "Regenerate a specific revision id.").option("--json", "Emit JSON output. Also automatic when stdout is piped").action(async (playName, options) => {
|
|
12254
|
+
process.exitCode = await handlePlayShareRegenerate([
|
|
12255
|
+
playName,
|
|
12256
|
+
...options.version ? ["--version", String(options.version)] : [],
|
|
12257
|
+
...options.revisionId ? ["--revision-id", options.revisionId] : [],
|
|
12258
|
+
...options.json ? ["--json"] : []
|
|
12259
|
+
]);
|
|
12260
|
+
});
|
|
12261
|
+
share.command("unpublish <play>").description(
|
|
12262
|
+
"Unshare: permanently delete the public page (frees it). Requires --yes."
|
|
12263
|
+
).option("-y, --yes", "Confirm taking the public page down (required).").option("--json", "Emit JSON output. Also automatic when stdout is piped").addHelpText(
|
|
12264
|
+
"after",
|
|
12265
|
+
`
|
|
12266
|
+
Mutates cloud state. Hard-deletes the page + its generated cards; the URL stops
|
|
12267
|
+
resolving. Org-admin only. Exit codes: 0 ok; 2 usage/missing --yes; 4 play not
|
|
12268
|
+
found.
|
|
12269
|
+
|
|
12270
|
+
Examples:
|
|
12271
|
+
deepline plays share unpublish company-to-contact --yes
|
|
12272
|
+
`
|
|
12273
|
+
).action(async (playName, options) => {
|
|
12274
|
+
process.exitCode = await handlePlayShareUnpublish([
|
|
12275
|
+
playName,
|
|
12276
|
+
...options.yes ? ["--yes"] : [],
|
|
12277
|
+
...options.json ? ["--json"] : []
|
|
12278
|
+
]);
|
|
12279
|
+
});
|
|
12280
|
+
}
|
|
12281
|
+
function shareFlagValue(args, flag) {
|
|
12282
|
+
const i = args.indexOf(flag);
|
|
12283
|
+
return i >= 0 && i + 1 < args.length ? args[i + 1] : void 0;
|
|
12284
|
+
}
|
|
12285
|
+
async function handlePlayShareStatus(args) {
|
|
12286
|
+
const target = args[0];
|
|
12287
|
+
if (!target) {
|
|
12288
|
+
console.error("Usage: deepline plays share status <play> [--json]");
|
|
12289
|
+
return 2;
|
|
12290
|
+
}
|
|
12291
|
+
const name = parseReferencedPlayTarget2(target).playName;
|
|
12292
|
+
const status = await new DeeplineClient().getSharePage(name);
|
|
12293
|
+
if (argsWantJson(args)) {
|
|
12294
|
+
process.stdout.write(`${JSON.stringify(status)}
|
|
12295
|
+
`);
|
|
12296
|
+
return 0;
|
|
12297
|
+
}
|
|
12298
|
+
if (!status.share) {
|
|
12299
|
+
console.log(`${status.playName}: not published.`);
|
|
12300
|
+
console.log(
|
|
12301
|
+
` Publish: deepline plays share publish ${status.playName} --yes`
|
|
12302
|
+
);
|
|
12303
|
+
return 0;
|
|
12304
|
+
}
|
|
12305
|
+
console.log(`${status.playName}: published v${status.share.publishedVersion}`);
|
|
12306
|
+
console.log(` url: ${status.share.publicPath}`);
|
|
12307
|
+
console.log(` seo: ${status.share.seoIndexing}`);
|
|
12308
|
+
console.log(
|
|
12309
|
+
` show: cost=${status.share.showAverageDeeplineCost} latency=${status.share.showAverageLatency}`
|
|
12310
|
+
);
|
|
12311
|
+
return 0;
|
|
12312
|
+
}
|
|
12313
|
+
async function handlePlaySharePublish(args) {
|
|
12314
|
+
const target = args[0];
|
|
12315
|
+
if (!target) {
|
|
12316
|
+
console.error(
|
|
12317
|
+
"Usage: deepline plays share publish <play> (--latest | --version <n> | --revision-id <id>) --yes [--seo index|noindex] [--show-cost] [--show-latency] [--json]"
|
|
12318
|
+
);
|
|
12319
|
+
return 2;
|
|
12320
|
+
}
|
|
12321
|
+
if (!args.includes("--yes")) {
|
|
12322
|
+
console.error(
|
|
12323
|
+
"Publishing creates a PUBLIC, SEO-indexable page. NOT recommended unless\nyou explicitly intend to share this play and accept the risks.\nRun results stay private, but the page exposes the play CODE: step names,\nfield names, tool ids, prompts/descriptions, and any hardcoded literals or\ncomments in the source \u2014 which may reveal PII or proprietary logic.\nReview the play source, then re-run with --yes to confirm."
|
|
12324
|
+
);
|
|
12325
|
+
return 2;
|
|
12326
|
+
}
|
|
12327
|
+
const name = parseReferencedPlayTarget2(target).playName;
|
|
12328
|
+
const client = new DeeplineClient();
|
|
12329
|
+
let revisionId = shareFlagValue(args, "--revision-id");
|
|
12330
|
+
let resolvedVersion;
|
|
12331
|
+
if (!revisionId) {
|
|
12332
|
+
const versions = await client.listPlayVersions(name);
|
|
12333
|
+
if (versions.length === 0) {
|
|
12334
|
+
console.error(
|
|
12335
|
+
`No saved revisions for ${name}. Run \`deepline plays set-live ${name}\` first.`
|
|
12336
|
+
);
|
|
12337
|
+
return 4;
|
|
12338
|
+
}
|
|
12339
|
+
const versionFlag = shareFlagValue(args, "--version");
|
|
12340
|
+
const chosen = versionFlag ? versions.find((r) => r.version === Number(versionFlag)) : versions[0];
|
|
12341
|
+
if (!chosen) {
|
|
12342
|
+
console.error(`Version ${versionFlag} not found for ${name}.`);
|
|
12343
|
+
return 4;
|
|
12344
|
+
}
|
|
12345
|
+
if (!chosen._id) {
|
|
12346
|
+
console.error("Resolved revision is missing an id.");
|
|
12347
|
+
return 5;
|
|
12348
|
+
}
|
|
12349
|
+
revisionId = chosen._id;
|
|
12350
|
+
resolvedVersion = chosen.version;
|
|
12351
|
+
}
|
|
12352
|
+
if (!args.includes("--no-run-check")) {
|
|
12353
|
+
const runs = await client.listRuns({ play: name });
|
|
12354
|
+
const hasCompleted = runs.some(
|
|
12355
|
+
(r) => String(r.status).toLowerCase() === "completed"
|
|
12356
|
+
);
|
|
12357
|
+
if (!hasCompleted) {
|
|
12358
|
+
const message = `No completed run for ${name}. Publish a play only after it has run successfully. (Override with --no-run-check.)`;
|
|
12359
|
+
if (argsWantJson(args)) {
|
|
12360
|
+
process.stdout.write(
|
|
12361
|
+
`${JSON.stringify({ ok: false, code: "NO_SUCCESSFUL_RUN", message, next: `deepline plays run ${name} --wait` })}
|
|
12362
|
+
`
|
|
12363
|
+
);
|
|
12364
|
+
} else {
|
|
12365
|
+
console.error(message);
|
|
12366
|
+
console.error(` deepline plays run ${name} --wait`);
|
|
12367
|
+
}
|
|
12368
|
+
return 7;
|
|
12369
|
+
}
|
|
12370
|
+
}
|
|
12371
|
+
const seo = shareFlagValue(args, "--seo");
|
|
12372
|
+
const seoIndexing = seo === "index" ? "index" : seo === "noindex" ? "noindex" : void 0;
|
|
12373
|
+
const request = {
|
|
12374
|
+
revisionId,
|
|
12375
|
+
acknowledgedUnlisted: true,
|
|
12376
|
+
showAverageDeeplineCost: args.includes("--show-cost"),
|
|
12377
|
+
showAverageLatency: args.includes("--show-latency"),
|
|
12378
|
+
...seoIndexing ? { seoIndexing } : {}
|
|
12379
|
+
};
|
|
12380
|
+
if (args.includes("--dry-run")) {
|
|
12381
|
+
const plan = { dryRun: true, name, version: resolvedVersion, ...request };
|
|
12382
|
+
if (argsWantJson(args)) {
|
|
12383
|
+
process.stdout.write(`${JSON.stringify(plan)}
|
|
12384
|
+
`);
|
|
12385
|
+
} else {
|
|
12386
|
+
console.log(
|
|
12387
|
+
`Would publish ${name}${resolvedVersion ? ` v${resolvedVersion}` : ""} (revision ${revisionId}).`
|
|
12388
|
+
);
|
|
12389
|
+
}
|
|
12390
|
+
return 0;
|
|
12391
|
+
}
|
|
12392
|
+
const status = await client.publishSharePage(name, request);
|
|
12393
|
+
if (argsWantJson(args)) {
|
|
12394
|
+
process.stdout.write(`${JSON.stringify(status)}
|
|
12395
|
+
`);
|
|
12396
|
+
return 0;
|
|
12397
|
+
}
|
|
12398
|
+
console.log(
|
|
12399
|
+
`Published ${name}${status.share ? ` v${status.share.publishedVersion}` : ""}: ${status.share?.publicPath ?? ""}`
|
|
12400
|
+
);
|
|
12401
|
+
if (status.warning) {
|
|
12402
|
+
console.error(`warning: ${status.warning}`);
|
|
12403
|
+
}
|
|
12404
|
+
return 0;
|
|
12405
|
+
}
|
|
12406
|
+
async function handlePlayShareUpdate(args) {
|
|
12407
|
+
const target = args[0];
|
|
12408
|
+
if (!target) {
|
|
12409
|
+
console.error(
|
|
12410
|
+
"Usage: deepline plays share update <play> [--seo index|noindex] [--show-cost|--hide-cost] [--show-latency|--hide-latency] [--json]"
|
|
12411
|
+
);
|
|
12412
|
+
return 2;
|
|
12413
|
+
}
|
|
12414
|
+
const name = parseReferencedPlayTarget2(target).playName;
|
|
12415
|
+
const seo = shareFlagValue(args, "--seo");
|
|
12416
|
+
const seoIndexing = seo === "index" ? "index" : seo === "noindex" ? "noindex" : void 0;
|
|
12417
|
+
const request = {
|
|
12418
|
+
...args.includes("--show-cost") ? { showAverageDeeplineCost: true } : args.includes("--hide-cost") ? { showAverageDeeplineCost: false } : {},
|
|
12419
|
+
...args.includes("--show-latency") ? { showAverageLatency: true } : args.includes("--hide-latency") ? { showAverageLatency: false } : {},
|
|
12420
|
+
...seoIndexing ? { seoIndexing } : {}
|
|
12421
|
+
};
|
|
12422
|
+
const status = await new DeeplineClient().updateSharePage(name, request);
|
|
12423
|
+
if (argsWantJson(args)) {
|
|
12424
|
+
process.stdout.write(`${JSON.stringify(status)}
|
|
12425
|
+
`);
|
|
12426
|
+
return 0;
|
|
12427
|
+
}
|
|
12428
|
+
console.log(`Updated ${name} share settings.`);
|
|
12429
|
+
return 0;
|
|
12430
|
+
}
|
|
12431
|
+
async function handlePlayShareRegenerate(args) {
|
|
12432
|
+
const target = args[0];
|
|
12433
|
+
if (!target) {
|
|
12434
|
+
console.error(
|
|
12435
|
+
"Usage: deepline plays share regenerate <play> [--version <n> | --revision-id <id>] [--json]"
|
|
12436
|
+
);
|
|
12437
|
+
return 2;
|
|
12438
|
+
}
|
|
12439
|
+
const name = parseReferencedPlayTarget2(target).playName;
|
|
12440
|
+
const client = new DeeplineClient();
|
|
12441
|
+
let revisionId = shareFlagValue(args, "--revision-id");
|
|
12442
|
+
const versionFlag = shareFlagValue(args, "--version");
|
|
12443
|
+
if (!revisionId && versionFlag) {
|
|
12444
|
+
const versions = await client.listPlayVersions(name);
|
|
12445
|
+
const chosen = versions.find((r) => r.version === Number(versionFlag));
|
|
12446
|
+
if (!chosen?._id) {
|
|
12447
|
+
console.error(`Version ${versionFlag} not found for ${name}.`);
|
|
12448
|
+
return 4;
|
|
12449
|
+
}
|
|
12450
|
+
revisionId = chosen._id;
|
|
12451
|
+
}
|
|
12452
|
+
const status = await client.regenerateSharePage(
|
|
12453
|
+
name,
|
|
12454
|
+
revisionId ? { revisionId } : {}
|
|
12455
|
+
);
|
|
12456
|
+
if (argsWantJson(args)) {
|
|
12457
|
+
process.stdout.write(`${JSON.stringify(status)}
|
|
12458
|
+
`);
|
|
12459
|
+
return 0;
|
|
12460
|
+
}
|
|
12461
|
+
console.log(`Regenerated public copy for ${name}.`);
|
|
12462
|
+
return 0;
|
|
12463
|
+
}
|
|
12464
|
+
async function handlePlayShareUnpublish(args) {
|
|
12465
|
+
const target = args[0];
|
|
12466
|
+
if (!target) {
|
|
12467
|
+
console.error("Usage: deepline plays share unpublish <play> --yes [--json]");
|
|
12468
|
+
return 2;
|
|
12469
|
+
}
|
|
12470
|
+
if (!args.includes("--yes")) {
|
|
12471
|
+
console.error(
|
|
12472
|
+
"Unpublishing permanently deletes the public page and frees its URL.\nRe-run with --yes to confirm."
|
|
12473
|
+
);
|
|
12474
|
+
return 2;
|
|
12475
|
+
}
|
|
12476
|
+
const name = parseReferencedPlayTarget2(target).playName;
|
|
12477
|
+
const status = await new DeeplineClient().unpublishSharePage(name);
|
|
12478
|
+
if (argsWantJson(args)) {
|
|
12479
|
+
process.stdout.write(`${JSON.stringify(status)}
|
|
12480
|
+
`);
|
|
12481
|
+
return 0;
|
|
12482
|
+
}
|
|
12483
|
+
console.log(`Unpublished ${name}; the public page has been removed.`);
|
|
12484
|
+
return 0;
|
|
12102
12485
|
}
|
|
12103
12486
|
|
|
12104
12487
|
// src/cli/commands/tools.ts
|
package/dist/index.d.mts
CHANGED
|
@@ -990,6 +990,56 @@ interface DeletePlayResult {
|
|
|
990
990
|
deletedBindingCount: number;
|
|
991
991
|
deletedRunCount: number;
|
|
992
992
|
}
|
|
993
|
+
/** Owner-facing view of a play's public share page. */
|
|
994
|
+
interface SharePageOwnerView {
|
|
995
|
+
shareSlug: string;
|
|
996
|
+
publishedRevisionId: string;
|
|
997
|
+
publishedVersion: number;
|
|
998
|
+
visibility: string;
|
|
999
|
+
seoIndexing: 'index' | 'noindex';
|
|
1000
|
+
showAverageDeeplineCost: boolean;
|
|
1001
|
+
showAverageLatency: boolean;
|
|
1002
|
+
/** Stable public path, e.g. `/p/{shareSlug}`. */
|
|
1003
|
+
publicPath: string;
|
|
1004
|
+
/** Version-pinned canonical path, e.g. `/p/{shareSlug}/v/{version}`. */
|
|
1005
|
+
canonicalPath: string;
|
|
1006
|
+
createdAt: number;
|
|
1007
|
+
updatedAt: number;
|
|
1008
|
+
}
|
|
1009
|
+
/** One row in the owner-facing revision picker for sharing. */
|
|
1010
|
+
interface SharePageRevisionOption {
|
|
1011
|
+
revisionId: string;
|
|
1012
|
+
version: number;
|
|
1013
|
+
isLive: boolean;
|
|
1014
|
+
isWorking: boolean;
|
|
1015
|
+
isPublished: boolean;
|
|
1016
|
+
hasMap: boolean;
|
|
1017
|
+
hasCard: boolean;
|
|
1018
|
+
createdAt: number;
|
|
1019
|
+
}
|
|
1020
|
+
/** Status payload from `GET/POST/PATCH /api/v2/plays/:name/share`. */
|
|
1021
|
+
interface SharePageStatus {
|
|
1022
|
+
playName: string;
|
|
1023
|
+
share: SharePageOwnerView | null;
|
|
1024
|
+
publishedCopy: unknown | null;
|
|
1025
|
+
revisions: SharePageRevisionOption[];
|
|
1026
|
+
/** Present on publish responses when share-card generation was non-strict. */
|
|
1027
|
+
warning?: string | null;
|
|
1028
|
+
}
|
|
1029
|
+
interface PublishSharePageRequest {
|
|
1030
|
+
/** The revision to publish/repoint the public page to. */
|
|
1031
|
+
revisionId: string;
|
|
1032
|
+
/** Must be true — acknowledges the page is publicly viewable. */
|
|
1033
|
+
acknowledgedUnlisted: true;
|
|
1034
|
+
showAverageDeeplineCost?: boolean;
|
|
1035
|
+
showAverageLatency?: boolean;
|
|
1036
|
+
seoIndexing?: 'index' | 'noindex';
|
|
1037
|
+
}
|
|
1038
|
+
interface UpdateSharePageRequest {
|
|
1039
|
+
showAverageDeeplineCost?: boolean;
|
|
1040
|
+
showAverageLatency?: boolean;
|
|
1041
|
+
seoIndexing?: 'index' | 'noindex';
|
|
1042
|
+
}
|
|
993
1043
|
|
|
994
1044
|
interface PlayStagedFileRef {
|
|
995
1045
|
storageKind: 'r2';
|
|
@@ -1568,6 +1618,34 @@ declare class DeeplineClient {
|
|
|
1568
1618
|
* bindings, and local run records. Deepline prebuilt plays are read-only.
|
|
1569
1619
|
*/
|
|
1570
1620
|
deletePlay(name: string): Promise<DeletePlayResult>;
|
|
1621
|
+
/**
|
|
1622
|
+
* Current share status for a play: the public page (if any), the published
|
|
1623
|
+
* copy, and the revision picker. Read-only.
|
|
1624
|
+
*/
|
|
1625
|
+
getSharePage(name: string): Promise<SharePageStatus>;
|
|
1626
|
+
/**
|
|
1627
|
+
* Publish (or repoint) the play's public share page to a revision. Requires
|
|
1628
|
+
* `acknowledgedUnlisted: true` — the page is publicly viewable. Org-admin only.
|
|
1629
|
+
*/
|
|
1630
|
+
publishSharePage(name: string, request: PublishSharePageRequest): Promise<SharePageStatus>;
|
|
1631
|
+
/**
|
|
1632
|
+
* Update share-page settings (SEO indexing, credit-cost / latency display)
|
|
1633
|
+
* without moving the published pointer. Org-admin only.
|
|
1634
|
+
*/
|
|
1635
|
+
updateSharePage(name: string, request: UpdateSharePageRequest): Promise<SharePageStatus>;
|
|
1636
|
+
/**
|
|
1637
|
+
* Unshare: hard-delete the play's public page and its cards. Returns the
|
|
1638
|
+
* fresh status (now `share: null`). Org-admin only. Idempotent — a no-op when
|
|
1639
|
+
* the play was never published.
|
|
1640
|
+
*/
|
|
1641
|
+
unpublishSharePage(name: string): Promise<SharePageStatus>;
|
|
1642
|
+
/**
|
|
1643
|
+
* Regenerate the LLM landing-page copy for a revision (defaults to the
|
|
1644
|
+
* published one). Org-admin only.
|
|
1645
|
+
*/
|
|
1646
|
+
regenerateSharePage(name: string, request?: {
|
|
1647
|
+
revisionId?: string;
|
|
1648
|
+
}): Promise<SharePageStatus>;
|
|
1571
1649
|
/**
|
|
1572
1650
|
* Run a play end-to-end: submit, stream until terminal, return result.
|
|
1573
1651
|
*
|
package/dist/index.d.ts
CHANGED
|
@@ -990,6 +990,56 @@ interface DeletePlayResult {
|
|
|
990
990
|
deletedBindingCount: number;
|
|
991
991
|
deletedRunCount: number;
|
|
992
992
|
}
|
|
993
|
+
/** Owner-facing view of a play's public share page. */
|
|
994
|
+
interface SharePageOwnerView {
|
|
995
|
+
shareSlug: string;
|
|
996
|
+
publishedRevisionId: string;
|
|
997
|
+
publishedVersion: number;
|
|
998
|
+
visibility: string;
|
|
999
|
+
seoIndexing: 'index' | 'noindex';
|
|
1000
|
+
showAverageDeeplineCost: boolean;
|
|
1001
|
+
showAverageLatency: boolean;
|
|
1002
|
+
/** Stable public path, e.g. `/p/{shareSlug}`. */
|
|
1003
|
+
publicPath: string;
|
|
1004
|
+
/** Version-pinned canonical path, e.g. `/p/{shareSlug}/v/{version}`. */
|
|
1005
|
+
canonicalPath: string;
|
|
1006
|
+
createdAt: number;
|
|
1007
|
+
updatedAt: number;
|
|
1008
|
+
}
|
|
1009
|
+
/** One row in the owner-facing revision picker for sharing. */
|
|
1010
|
+
interface SharePageRevisionOption {
|
|
1011
|
+
revisionId: string;
|
|
1012
|
+
version: number;
|
|
1013
|
+
isLive: boolean;
|
|
1014
|
+
isWorking: boolean;
|
|
1015
|
+
isPublished: boolean;
|
|
1016
|
+
hasMap: boolean;
|
|
1017
|
+
hasCard: boolean;
|
|
1018
|
+
createdAt: number;
|
|
1019
|
+
}
|
|
1020
|
+
/** Status payload from `GET/POST/PATCH /api/v2/plays/:name/share`. */
|
|
1021
|
+
interface SharePageStatus {
|
|
1022
|
+
playName: string;
|
|
1023
|
+
share: SharePageOwnerView | null;
|
|
1024
|
+
publishedCopy: unknown | null;
|
|
1025
|
+
revisions: SharePageRevisionOption[];
|
|
1026
|
+
/** Present on publish responses when share-card generation was non-strict. */
|
|
1027
|
+
warning?: string | null;
|
|
1028
|
+
}
|
|
1029
|
+
interface PublishSharePageRequest {
|
|
1030
|
+
/** The revision to publish/repoint the public page to. */
|
|
1031
|
+
revisionId: string;
|
|
1032
|
+
/** Must be true — acknowledges the page is publicly viewable. */
|
|
1033
|
+
acknowledgedUnlisted: true;
|
|
1034
|
+
showAverageDeeplineCost?: boolean;
|
|
1035
|
+
showAverageLatency?: boolean;
|
|
1036
|
+
seoIndexing?: 'index' | 'noindex';
|
|
1037
|
+
}
|
|
1038
|
+
interface UpdateSharePageRequest {
|
|
1039
|
+
showAverageDeeplineCost?: boolean;
|
|
1040
|
+
showAverageLatency?: boolean;
|
|
1041
|
+
seoIndexing?: 'index' | 'noindex';
|
|
1042
|
+
}
|
|
993
1043
|
|
|
994
1044
|
interface PlayStagedFileRef {
|
|
995
1045
|
storageKind: 'r2';
|
|
@@ -1568,6 +1618,34 @@ declare class DeeplineClient {
|
|
|
1568
1618
|
* bindings, and local run records. Deepline prebuilt plays are read-only.
|
|
1569
1619
|
*/
|
|
1570
1620
|
deletePlay(name: string): Promise<DeletePlayResult>;
|
|
1621
|
+
/**
|
|
1622
|
+
* Current share status for a play: the public page (if any), the published
|
|
1623
|
+
* copy, and the revision picker. Read-only.
|
|
1624
|
+
*/
|
|
1625
|
+
getSharePage(name: string): Promise<SharePageStatus>;
|
|
1626
|
+
/**
|
|
1627
|
+
* Publish (or repoint) the play's public share page to a revision. Requires
|
|
1628
|
+
* `acknowledgedUnlisted: true` — the page is publicly viewable. Org-admin only.
|
|
1629
|
+
*/
|
|
1630
|
+
publishSharePage(name: string, request: PublishSharePageRequest): Promise<SharePageStatus>;
|
|
1631
|
+
/**
|
|
1632
|
+
* Update share-page settings (SEO indexing, credit-cost / latency display)
|
|
1633
|
+
* without moving the published pointer. Org-admin only.
|
|
1634
|
+
*/
|
|
1635
|
+
updateSharePage(name: string, request: UpdateSharePageRequest): Promise<SharePageStatus>;
|
|
1636
|
+
/**
|
|
1637
|
+
* Unshare: hard-delete the play's public page and its cards. Returns the
|
|
1638
|
+
* fresh status (now `share: null`). Org-admin only. Idempotent — a no-op when
|
|
1639
|
+
* the play was never published.
|
|
1640
|
+
*/
|
|
1641
|
+
unpublishSharePage(name: string): Promise<SharePageStatus>;
|
|
1642
|
+
/**
|
|
1643
|
+
* Regenerate the LLM landing-page copy for a revision (defaults to the
|
|
1644
|
+
* published one). Org-admin only.
|
|
1645
|
+
*/
|
|
1646
|
+
regenerateSharePage(name: string, request?: {
|
|
1647
|
+
revisionId?: string;
|
|
1648
|
+
}): Promise<SharePageStatus>;
|
|
1571
1649
|
/**
|
|
1572
1650
|
* Run a play end-to-end: submit, stream until terminal, return result.
|
|
1573
1651
|
*
|
package/dist/index.js
CHANGED
|
@@ -241,10 +241,10 @@ var import_node_path2 = require("path");
|
|
|
241
241
|
|
|
242
242
|
// src/release.ts
|
|
243
243
|
var SDK_RELEASE = {
|
|
244
|
-
version: "0.1.
|
|
244
|
+
version: "0.1.67",
|
|
245
245
|
apiContract: "2026-05-play-bootstrap-dataset-summary",
|
|
246
246
|
supportPolicy: {
|
|
247
|
-
latest: "0.1.
|
|
247
|
+
latest: "0.1.67",
|
|
248
248
|
minimumSupported: "0.1.53",
|
|
249
249
|
deprecatedBelow: "0.1.53"
|
|
250
250
|
}
|
|
@@ -495,6 +495,9 @@ var HttpClient = class {
|
|
|
495
495
|
headers
|
|
496
496
|
});
|
|
497
497
|
}
|
|
498
|
+
async patch(path, body, headers) {
|
|
499
|
+
return this.request(path, { method: "PATCH", body, headers });
|
|
500
|
+
}
|
|
498
501
|
/**
|
|
499
502
|
* Send a DELETE request.
|
|
500
503
|
*
|
|
@@ -1618,6 +1621,61 @@ var DeeplineClient = class {
|
|
|
1618
1621
|
return this.http.delete(`/api/v2/plays/${encodedName}`);
|
|
1619
1622
|
}
|
|
1620
1623
|
// ——————————————————————————————————————————————————————————
|
|
1624
|
+
// Plays — public share pages
|
|
1625
|
+
// ——————————————————————————————————————————————————————————
|
|
1626
|
+
/**
|
|
1627
|
+
* Current share status for a play: the public page (if any), the published
|
|
1628
|
+
* copy, and the revision picker. Read-only.
|
|
1629
|
+
*/
|
|
1630
|
+
async getSharePage(name) {
|
|
1631
|
+
const encodedName = encodeURIComponent(name);
|
|
1632
|
+
return this.http.get(`/api/v2/plays/${encodedName}/share`);
|
|
1633
|
+
}
|
|
1634
|
+
/**
|
|
1635
|
+
* Publish (or repoint) the play's public share page to a revision. Requires
|
|
1636
|
+
* `acknowledgedUnlisted: true` — the page is publicly viewable. Org-admin only.
|
|
1637
|
+
*/
|
|
1638
|
+
async publishSharePage(name, request) {
|
|
1639
|
+
const encodedName = encodeURIComponent(name);
|
|
1640
|
+
return this.http.post(
|
|
1641
|
+
`/api/v2/plays/${encodedName}/share`,
|
|
1642
|
+
request
|
|
1643
|
+
);
|
|
1644
|
+
}
|
|
1645
|
+
/**
|
|
1646
|
+
* Update share-page settings (SEO indexing, credit-cost / latency display)
|
|
1647
|
+
* without moving the published pointer. Org-admin only.
|
|
1648
|
+
*/
|
|
1649
|
+
async updateSharePage(name, request) {
|
|
1650
|
+
const encodedName = encodeURIComponent(name);
|
|
1651
|
+
return this.http.patch(
|
|
1652
|
+
`/api/v2/plays/${encodedName}/share`,
|
|
1653
|
+
request
|
|
1654
|
+
);
|
|
1655
|
+
}
|
|
1656
|
+
/**
|
|
1657
|
+
* Unshare: hard-delete the play's public page and its cards. Returns the
|
|
1658
|
+
* fresh status (now `share: null`). Org-admin only. Idempotent — a no-op when
|
|
1659
|
+
* the play was never published.
|
|
1660
|
+
*/
|
|
1661
|
+
async unpublishSharePage(name) {
|
|
1662
|
+
const encodedName = encodeURIComponent(name);
|
|
1663
|
+
return this.http.delete(
|
|
1664
|
+
`/api/v2/plays/${encodedName}/share`
|
|
1665
|
+
);
|
|
1666
|
+
}
|
|
1667
|
+
/**
|
|
1668
|
+
* Regenerate the LLM landing-page copy for a revision (defaults to the
|
|
1669
|
+
* published one). Org-admin only.
|
|
1670
|
+
*/
|
|
1671
|
+
async regenerateSharePage(name, request = {}) {
|
|
1672
|
+
const encodedName = encodeURIComponent(name);
|
|
1673
|
+
return this.http.post(
|
|
1674
|
+
`/api/v2/plays/${encodedName}/share/regenerate`,
|
|
1675
|
+
request
|
|
1676
|
+
);
|
|
1677
|
+
}
|
|
1678
|
+
// ——————————————————————————————————————————————————————————
|
|
1621
1679
|
// Plays — high-level orchestration
|
|
1622
1680
|
// ——————————————————————————————————————————————————————————
|
|
1623
1681
|
/**
|