terse-cli 0.4.7 → 0.5.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 (63) hide show
  1. package/dist/commands/deploy.d.ts.map +1 -1
  2. package/dist/commands/deploy.js +3 -2
  3. package/dist/commands/deploy.js.map +1 -1
  4. package/dist/index.js +1 -1
  5. package/dist/index.js.map +1 -1
  6. package/dist/providers/typescript/TypeScriptProvider.d.ts +2 -0
  7. package/dist/providers/typescript/TypeScriptProvider.d.ts.map +1 -1
  8. package/dist/providers/typescript/TypeScriptProvider.js +32 -13
  9. package/dist/providers/typescript/TypeScriptProvider.js.map +1 -1
  10. package/dist/providers/typescript/jobMacro.d.ts +1 -2
  11. package/dist/providers/typescript/jobMacro.d.ts.map +1 -1
  12. package/dist/providers/typescript/jobMacro.js +69 -111
  13. package/dist/providers/typescript/jobMacro.js.map +1 -1
  14. package/dist/providers/typescript/jobSources.d.ts +7 -0
  15. package/dist/providers/typescript/jobSources.d.ts.map +1 -0
  16. package/dist/providers/typescript/jobSources.js +46 -0
  17. package/dist/providers/typescript/jobSources.js.map +1 -0
  18. package/dist/providers/typescript/runtimes/durableJobRuntime.d.ts.map +1 -1
  19. package/dist/providers/typescript/runtimes/durableJobRuntime.js +98 -54
  20. package/dist/providers/typescript/runtimes/durableJobRuntime.js.map +1 -1
  21. package/dist/providers/typescript/stepMacro.d.ts +2 -29
  22. package/dist/providers/typescript/stepMacro.d.ts.map +1 -1
  23. package/dist/providers/typescript/stepMacro.js +29 -120
  24. package/dist/providers/typescript/stepMacro.js.map +1 -1
  25. package/dist/providers/typescript/terseWorkflow.d.ts +8 -0
  26. package/dist/providers/typescript/terseWorkflow.d.ts.map +1 -0
  27. package/dist/providers/typescript/terseWorkflow.js +8 -0
  28. package/dist/providers/typescript/terseWorkflow.js.map +1 -0
  29. package/package.json +6 -8
  30. package/src/providers/typescript/modules/github/github.triggers.hbs +4 -0
  31. package/templates/typescript/init/gitignore.hbs +1 -0
  32. package/templates/typescript/init/package.json.hbs +0 -1
  33. package/dist/providers/typescript/durableRuntime.d.ts +0 -20
  34. package/dist/providers/typescript/durableRuntime.d.ts.map +0 -1
  35. package/dist/providers/typescript/durableRuntime.js +0 -211
  36. package/dist/providers/typescript/durableRuntime.js.map +0 -1
  37. package/dist/providers/typescript/rewindRun.d.ts +0 -9
  38. package/dist/providers/typescript/rewindRun.d.ts.map +0 -1
  39. package/dist/providers/typescript/rewindRun.js +0 -111
  40. package/dist/providers/typescript/rewindRun.js.map +0 -1
  41. package/dist/providers/typescript/terseWorkflowBuilder.d.ts +0 -8
  42. package/dist/providers/typescript/terseWorkflowBuilder.d.ts.map +0 -1
  43. package/dist/providers/typescript/terseWorkflowBuilder.js +0 -70
  44. package/dist/providers/typescript/terseWorkflowBuilder.js.map +0 -1
  45. package/dist/providers/typescript/workflowCoreVersion.d.ts +0 -2
  46. package/dist/providers/typescript/workflowCoreVersion.d.ts.map +0 -1
  47. package/dist/providers/typescript/workflowCoreVersion.js +0 -7
  48. package/dist/providers/typescript/workflowCoreVersion.js.map +0 -1
  49. package/dist/providers/typescript/workflowShim.d.ts +0 -2
  50. package/dist/providers/typescript/workflowShim.d.ts.map +0 -1
  51. package/dist/providers/typescript/workflowShim.js +0 -51
  52. package/dist/providers/typescript/workflowShim.js.map +0 -1
  53. package/dist/terseWorld.d.ts +0 -4
  54. package/dist/terseWorld.d.ts.map +0 -1
  55. package/dist/terseWorld.js +0 -46
  56. package/dist/terseWorld.js.map +0 -1
  57. package/templates/typescript/workflow-shim/api.js +0 -5
  58. package/templates/typescript/workflow-shim/index.js +0 -2
  59. package/templates/typescript/workflow-shim/internal/builtins.js +0 -83
  60. package/templates/typescript/workflow-shim/internal/class-serialization.js +0 -1
  61. package/templates/typescript/workflow-shim/runtime.js +0 -1
  62. package/templates/typescript/workflow-shim/stdlib.js +0 -18
  63. package/templates/typescript/workflow-shim/workflow.js +0 -2
@@ -1,2 +0,0 @@
1
- export declare function expectedWorkflowCoreVersion(): string;
2
- //# sourceMappingURL=workflowCoreVersion.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"workflowCoreVersion.d.ts","sourceRoot":"","sources":["../../../src/providers/typescript/workflowCoreVersion.ts"],"names":[],"mappings":"AAGA,wBAAgB,2BAA2B,IAAI,MAAM,CAGpD"}
@@ -1,7 +0,0 @@
1
- import fs from "node:fs";
2
- // Split out of durableRuntime so callers can read the pin without pulling in @workflow/core.
3
- export function expectedWorkflowCoreVersion() {
4
- const cliPackageJson = new URL("../../../package.json", import.meta.url);
5
- return JSON.parse(fs.readFileSync(cliPackageJson, "utf8")).dependencies["@workflow/core"];
6
- }
7
- //# sourceMappingURL=workflowCoreVersion.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"workflowCoreVersion.js","sourceRoot":"","sources":["../../../src/providers/typescript/workflowCoreVersion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAA;AAExB,6FAA6F;AAC7F,MAAM,UAAU,2BAA2B;IACvC,MAAM,cAAc,GAAG,IAAI,GAAG,CAAC,uBAAuB,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;IACxE,OAAO,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,cAAc,EAAE,MAAM,CAAC,CAAC,CAAC,YAAY,CAAC,gBAAgB,CAAC,CAAA;AAC7F,CAAC"}
@@ -1,2 +0,0 @@
1
- export declare function writeWorkflowShim(cwd: string, workflowCoreVersion: string): void;
2
- //# sourceMappingURL=workflowShim.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"workflowShim.d.ts","sourceRoot":"","sources":["../../../src/providers/typescript/workflowShim.ts"],"names":[],"mappings":"AAaA,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,EAAE,mBAAmB,EAAE,MAAM,GAAG,IAAI,CAOhF"}
@@ -1,51 +0,0 @@
1
- import fs from "node:fs";
2
- import path from "node:path";
3
- import { readTemplateFile } from "../templateUtils.js";
4
- const SHIM_DIR = path.join("node_modules", "workflow");
5
- const SHIM_TEMPLATE_DIR = path.join("typescript", "workflow-shim");
6
- const SHIM_MARKER = "terseWorkflowShim";
7
- // @workflow/builders hardcodes two specifiers that it resolves from the project root: `workflow/runtime`
8
- // (injected into the generated bundle wrapper) and `workflow/internal/builtins`. This shim satisfies both
9
- // out of `@workflow/core`, which keeps the `workflow` umbrella (CLI, framework adapters, SWC, esbuild,
10
- // ~150MB) out of every user project and every sandbox image.
11
- export function writeWorkflowShim(cwd, workflowCoreVersion) {
12
- const shimRoot = path.join(cwd, SHIM_DIR);
13
- if (hasRealWorkflowPackage(shimRoot))
14
- return;
15
- fs.mkdirSync(path.join(shimRoot, "internal"), { recursive: true });
16
- fs.writeFileSync(path.join(shimRoot, "package.json"), shimPackageJson(workflowCoreVersion));
17
- SHIM_FILES.forEach(file => fs.writeFileSync(path.join(shimRoot, file), readTemplateFile(path.join(SHIM_TEMPLATE_DIR, file))));
18
- }
19
- // helpers
20
- const SHIM_FILES = ["index.js", "workflow.js", "runtime.js", "api.js", "stdlib.js", path.join("internal", "builtins.js"), path.join("internal", "class-serialization.js")];
21
- // A project that depends on `workflow` itself already satisfies the builder, and its copy is the real one.
22
- function hasRealWorkflowPackage(shimRoot) {
23
- const manifest = path.join(shimRoot, "package.json");
24
- if (!fs.existsSync(manifest))
25
- return false;
26
- return readShimMarker(manifest) !== true;
27
- }
28
- function readShimMarker(manifest) {
29
- try {
30
- return JSON.parse(fs.readFileSync(manifest, "utf8"))[SHIM_MARKER];
31
- }
32
- catch {
33
- return undefined;
34
- }
35
- }
36
- function shimPackageJson(workflowCoreVersion) {
37
- return `${JSON.stringify({
38
- name: "workflow",
39
- version: workflowCoreVersion,
40
- type: "module",
41
- [SHIM_MARKER]: true,
42
- exports: {
43
- ".": { workflow: "./workflow.js", default: "./index.js" },
44
- "./runtime": "./runtime.js",
45
- "./api": "./api.js",
46
- "./internal/builtins": "./internal/builtins.js",
47
- "./internal/class-serialization": "./internal/class-serialization.js"
48
- }
49
- }, null, 2)}\n`;
50
- }
51
- //# sourceMappingURL=workflowShim.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"workflowShim.js","sourceRoot":"","sources":["../../../src/providers/typescript/workflowShim.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAA;AACxB,OAAO,IAAI,MAAM,WAAW,CAAA;AAE5B,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AAEtD,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,UAAU,CAAC,CAAA;AACtD,MAAM,iBAAiB,GAAG,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,eAAe,CAAC,CAAA;AAClE,MAAM,WAAW,GAAG,mBAAmB,CAAA;AAEvC,yGAAyG;AACzG,0GAA0G;AAC1G,uGAAuG;AACvG,6DAA6D;AAC7D,MAAM,UAAU,iBAAiB,CAAC,GAAW,EAAE,mBAA2B;IACtE,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAA;IACzC,IAAI,sBAAsB,CAAC,QAAQ,CAAC;QAAE,OAAM;IAE5C,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,UAAU,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAA;IAClE,EAAE,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,cAAc,CAAC,EAAE,eAAe,CAAC,mBAAmB,CAAC,CAAC,CAAA;IAC3F,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,EAAE,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,iBAAiB,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,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LocalWorld } from "@workflow/world-local";
2
- export type TerseWorld = LocalWorld;
3
- export declare function createTerseWorld(): TerseWorld;
4
- //# sourceMappingURL=terseWorld.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"terseWorld.d.ts","sourceRoot":"","sources":["../src/terseWorld.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAQvD,MAAM,MAAM,UAAU,GAAG,UAAU,CAAA;AAMnC,wBAAgB,gBAAgB,IAAI,UAAU,CAU7C"}
@@ -1,46 +0,0 @@
1
- import { createLocalWorld } from "@workflow/world-local";
2
- import path from "path";
3
- import { ApiRoutes } from "terse-types";
4
- import { fetchWithAuth, readRuntimeKeyOrBail } from "./api.js";
5
- // Waits shorter than this stay in-process: tearing down and respawning a sandbox
6
- // costs more than just waiting, so only longer waits hand off to Terse.
7
- const SUSPEND_THRESHOLD_SECONDS = Number(process.env.TERSE_SUSPEND_THRESHOLD_SECONDS) || 30;
8
- export function createTerseWorld() {
9
- const dataDir = process.env.WORKFLOW_LOCAL_DATA_DIR ?? path.join(process.cwd(), ".terse", "data");
10
- const base = createLocalWorld({ dataDir });
11
- const baseQueue = base.queue.bind(base);
12
- return {
13
- ...base,
14
- processExitTriggersQueueRedelivery: true,
15
- queue: terseQueue(baseQueue)
16
- };
17
- }
18
- // helpers
19
- function terseQueue(baseQueue) {
20
- return (name, message, opts) => {
21
- if (opts?.delaySeconds && opts.delaySeconds > SUSPEND_THRESHOLD_SECONDS) {
22
- return scheduleTerseTimer(name, opts).then(() => ({ messageId: null }));
23
- }
24
- return baseQueue(name, message, opts);
25
- };
26
- }
27
- async function scheduleTerseTimer(name, opts) {
28
- const runId = process.env.TERSE_RUN_ID;
29
- if (!runId) {
30
- throw new Error(`Cannot suspend: TERSE_RUN_ID is not set (queue "${name}").`);
31
- }
32
- const delaySeconds = opts.delaySeconds;
33
- if (!delaySeconds || delaySeconds <= 0) {
34
- throw new Error(`scheduleTerseTimer requires a positive delaySeconds (queue "${name}").`);
35
- }
36
- const apiKey = readRuntimeKeyOrBail();
37
- const body = {
38
- runId,
39
- name,
40
- delaySeconds,
41
- ...(opts.idempotencyKey ? { idempotencyKey: opts.idempotencyKey } : {})
42
- };
43
- await fetchWithAuth(ApiRoutes.SDK.SUSPEND, apiKey, body, "POST");
44
- return { messageId: null };
45
- }
46
- //# sourceMappingURL=terseWorld.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"terseWorld.js","sourceRoot":"","sources":["../src/terseWorld.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AACxD,OAAO,IAAI,MAAM,MAAM,CAAA;AACvB,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAGvC,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAA;AAI9D,iFAAiF;AACjF,wEAAwE;AACxE,MAAM,yBAAyB,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,+BAA+B,CAAC,IAAI,EAAE,CAAA;AAE3F,MAAM,UAAU,gBAAgB;IAC5B,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,uBAAuB,IAAI,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAA;IACjG,MAAM,IAAI,GAAG,gBAAgB,CAAC,EAAE,OAAO,EAAE,CAAC,CAAA;IAC1C,MAAM,SAAS,GAAmB,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IAEvD,OAAO;QACH,GAAG,IAAI;QACP,kCAAkC,EAAE,IAAI;QACxC,KAAK,EAAE,UAAU,CAAC,SAAS,CAAC;KAC/B,CAAA;AACL,CAAC;AAED,UAAU;AAEV,SAAS,UAAU,CAAC,SAAyB;IACzC,OAAO,CAAC,IAAoB,EAAE,OAAqB,EAAE,IAAmB,EAAE,EAAE;QACx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time/resume-hook"
4
- export { getRun, Run } from "@workflow/core/runtime/run"
5
- export { start } from "@workflow/core/runtime/start"
@@ -1,2 +0,0 @@
1
- export * from "@workflow/core"
2
- export * from "./stdlib.js"
@@ -1,83 +0,0 @@
1
- // Vendored verbatim from workflow@5.0.0-beta.19 dist/internal/builtins.js. Re-sync when the
2
- // pinned @workflow/core version changes: these are compiled step sources, not a re-export.
3
- /**
4
- * These are the built-in steps that are "automatically available" in the workflow scope. They are
5
- * similar to "stdlib" except that are not meant to be imported by users, but are instead "just available"
6
- * alongside user defined steps. They are used internally by the runtime
7
- */
8
- export async function __builtin_response_array_buffer() {
9
- 'use step';
10
- return this.arrayBuffer();
11
- }
12
- export async function __builtin_response_json() {
13
- 'use step';
14
- return this.json();
15
- }
16
- export async function __builtin_response_text() {
17
- 'use step';
18
- return this.text();
19
- }
20
- /**
21
- * Process-wide dedupe for the unsupported-world warning so high-volume
22
- * callers don't flood logs.
23
- */
24
- const UNSUPPORTED_WORLD_WARNED = Symbol.for('@workflow/setAttributes//unsupportedWorldWarned');
25
- const INTERNAL_ATTRIBUTES_MAX_ATTEMPTS = 3;
26
- function formatUnknownError(error) {
27
- if (error instanceof Error) {
28
- return error.stack ?? `${error.name}: ${error.message}`;
29
- }
30
- return String(error);
31
- }
32
- /**
33
- * Step bridge for workflow-body `setAttributes` calls. The VM-side
34
- * helper validates input and dispatches here via `useStep`. This step
35
- * runs in normal Node context with full world access.
36
- *
37
- * The dispatch reads the world and current run id directly from
38
- * `globalThis` symbols populated by the workflow/step runtime — this
39
- * intentionally avoids importing `@workflow/core` so the Next.js
40
- * deferred-entries discoverer can't walk a chain into world adapters
41
- * and `@vercel/queue` from this step file.
42
- */
43
- export async function __builtin_set_attributes(changes, options) {
44
- 'use step';
45
- if (changes.length === 0)
46
- return;
47
- const g = globalThis;
48
- const contextStorage = g[Symbol.for('WORKFLOW_STEP_CONTEXT_STORAGE')];
49
- const store = contextStorage?.getStore?.();
50
- const attempt = typeof store?.stepMetadata?.attempt === 'number'
51
- ? store.stepMetadata.attempt
52
- : INTERNAL_ATTRIBUTES_MAX_ATTEMPTS;
53
- const world = g[Symbol.for('@workflow/world//cache')];
54
- if (typeof world?.runs?.experimentalSetAttributes !== 'function') {
55
- // World adapter doesn't implement attributes yet — no-op the call,
56
- // but emit one process-wide warning so users know their writes are
57
- // being dropped. The VM-side validation already ran so the input
58
- // is well-formed.
59
- if (!g[UNSUPPORTED_WORLD_WARNED]) {
60
- g[UNSUPPORTED_WORLD_WARNED] = true;
61
- const worldName = world?.name ? ` (${world.name})` : '';
62
- console.warn(`[workflow] setAttributes: the current world implementation${worldName} does not implement experimentalSetAttributes; this call (and any subsequent setAttributes calls in this process) is a no-op. Attributes will become available once the world adapter adds support.`);
63
- }
64
- return;
65
- }
66
- try {
67
- const runId = store?.workflowMetadata?.workflowRunId;
68
- if (!runId) {
69
- throw new Error('__builtin_set_attributes: no workflow run id available in step context');
70
- }
71
- await world.runs.experimentalSetAttributes(runId, changes, options);
72
- }
73
- catch (error) {
74
- if (attempt < INTERNAL_ATTRIBUTES_MAX_ATTEMPTS) {
75
- throw error;
76
- }
77
- // Failing to post tags should not fail a run during the experimental phase.
78
- // After three attempts, log and let the internal step complete so the
79
- // runtime does not convert retry exhaustion into a FatalError.
80
- console.error(`[workflow] setAttributes: failed to post tags after ${INTERNAL_ATTRIBUTES_MAX_ATTEMPTS} attempts; dropping the internal attribute write. ${formatUnknownError(error)}`);
81
- }
82
- }
83
- __builtin_set_attributes.maxRetries = INTERNAL_ATTRIBUTES_MAX_ATTEMPTS - 1;
@@ -1 +0,0 @@
1
- export * from "@workflow/core/class-serialization"
@@ -1 +0,0 @@
1
- export * from "@workflow/core/runtime"
@@ -1,18 +0,0 @@
1
- // Vendored verbatim from workflow@5.0.0-beta.19 dist/stdlib.js. Re-sync when the pinned
2
- // @workflow/core version changes: these are compiled step sources, not a re-export.
3
- /**
4
- * This is the "standard library" of steps that we make available to all workflow users.
5
- * The can be imported like so: `import { fetch } from 'workflow'`. and used in workflow.
6
- * The need to be exported directly in this package and cannot live in `core` to prevent
7
- * circular dependencies post-compilation.
8
- */
9
- /**
10
- * A hoisted `fetch()` function that is executed as a "step" function,
11
- * for use within workflow functions.
12
- *
13
- * @see https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API
14
- */
15
- export async function fetch(...args) {
16
- 'use step';
17
- return globalThis.fetch(...args);
18
- }
@@ -1,2 +0,0 @@
1
- export * from "@workflow/core/_workflow"
2
- export * from "./stdlib.js"