@diagonal-hq/workflows 0.6.0 → 0.6.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.
- package/README.md +1 -1
- package/dist/chunks/{chunk-EU2ME5WR.js → chunk-55XJDIQB.js} +1 -1
- package/dist/chunks/{chunk-4YUQWAM6.js → chunk-IQF5EEBK.js} +3 -3
- package/dist/chunks/{chunk-OF5QITP7.js → chunk-XJOXCKID.js} +5 -1
- package/dist/errors.d.ts +19 -1
- package/dist/generated/capabilities.d.ts +1 -1
- package/dist/http-transport.js +9 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.js +3 -3
- package/dist/profiles/test.js +3 -3
- package/dist/testing/index.js +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -76,7 +76,7 @@ Imported from this package, `runWorkflow` runs the handler in Node. A deployed s
|
|
|
76
76
|
|
|
77
77
|
- It always runs the `validate` option of the workflow config, as a deployed run does. It runs a `validateInput` export only when the test passes that export as the `validateInput` option. Another validator, or a `validateInput` option for a workflow with a `validate` option, is refused.
|
|
78
78
|
- Inputs, context, mock replies, and the result cross the engine boundary as JSON. A handler that returns `undefined` gives `null`, and a `Date` becomes a string.
|
|
79
|
-
- A `WorkflowFailure` or `HostError` from the script is rethrown as that class. A mock that throws another error reaches the script as a `HostError` with the code `internal_error`.
|
|
79
|
+
- A `WorkflowFailure` or `HostError` from the script is rethrown as that class. A mock that throws another error reaches the script as a `HostError` with the code `internal_error` and `failure: null`. To test a script that reads `failure`, make the mock throw a `HostError` with the `failure` argument.
|
|
80
80
|
- A workflow that the test defines itself has no compiled code, so it runs in Node.
|
|
81
81
|
|
|
82
82
|
### QuickJS limits
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
invoke
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-55XJDIQB.js";
|
|
4
4
|
import {
|
|
5
5
|
HostError
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-XJOXCKID.js";
|
|
7
7
|
|
|
8
8
|
// packages/workflows/src/transaction.ts
|
|
9
9
|
async function transaction(fn) {
|
|
@@ -48,7 +48,7 @@ function isTransient(error) {
|
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
// packages/workflows/src/generated/capabilities.ts
|
|
51
|
-
var SDK_VERSION =
|
|
51
|
+
var SDK_VERSION = 69;
|
|
52
52
|
var ai = {
|
|
53
53
|
/** Ask a decisions model typed questions about some content and get labelled answers with their probabilities */
|
|
54
54
|
decide: (input) => invoke("ai.decide", input),
|
|
@@ -3,19 +3,23 @@ var HostError = class extends Error {
|
|
|
3
3
|
/**
|
|
4
4
|
* @param failureId The host's ID for the failure of the call. When the error ends the run, the
|
|
5
5
|
* host records that failure, so a run records the failure of the call that it rethrows.
|
|
6
|
+
* @param failure The failure that a graph step records for the same error, or null for a
|
|
7
|
+
* refusal that only a script call can receive, such as an unknown capability.
|
|
6
8
|
*/
|
|
7
|
-
constructor(message, code, status, details, failureId = null) {
|
|
9
|
+
constructor(message, code, status, details, failureId = null, failure = null) {
|
|
8
10
|
super(message);
|
|
9
11
|
this.code = code;
|
|
10
12
|
this.status = status;
|
|
11
13
|
this.details = details;
|
|
12
14
|
this.failureId = failureId;
|
|
15
|
+
this.failure = failure;
|
|
13
16
|
this.name = "HostError";
|
|
14
17
|
}
|
|
15
18
|
code;
|
|
16
19
|
status;
|
|
17
20
|
details;
|
|
18
21
|
failureId;
|
|
22
|
+
failure;
|
|
19
23
|
};
|
|
20
24
|
var WorkflowFailure = class extends Error {
|
|
21
25
|
constructor(message, status, details = null) {
|
package/dist/errors.d.ts
CHANGED
|
@@ -1,13 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The failure that a graph step records when its task throws, which the step's error edge reads.
|
|
3
|
+
* A task failure has `type`, `message`, and `status_code`. An unexpected exception also has
|
|
4
|
+
* `original_type`, a validation failure has `errors`, and a refused input has `invalid_input`.
|
|
5
|
+
* A declared error is keyed by its type, and a failed child workflow gives its own failure.
|
|
6
|
+
*/
|
|
7
|
+
export type HostFailure = {
|
|
8
|
+
type?: string;
|
|
9
|
+
message?: string;
|
|
10
|
+
original_type?: string;
|
|
11
|
+
status_code?: number;
|
|
12
|
+
errors?: Record<string, string[]>;
|
|
13
|
+
invalid_input?: unknown;
|
|
14
|
+
[key: string]: unknown;
|
|
15
|
+
};
|
|
1
16
|
export declare class HostError extends Error {
|
|
2
17
|
readonly code: string;
|
|
3
18
|
readonly status: number;
|
|
4
19
|
readonly details: unknown;
|
|
5
20
|
readonly failureId: number | null;
|
|
21
|
+
readonly failure: HostFailure | null;
|
|
6
22
|
/**
|
|
7
23
|
* @param failureId The host's ID for the failure of the call. When the error ends the run, the
|
|
8
24
|
* host records that failure, so a run records the failure of the call that it rethrows.
|
|
25
|
+
* @param failure The failure that a graph step records for the same error, or null for a
|
|
26
|
+
* refusal that only a script call can receive, such as an unknown capability.
|
|
9
27
|
*/
|
|
10
|
-
constructor(message: string, code: string, status: number, details: unknown, failureId?: number | null);
|
|
28
|
+
constructor(message: string, code: string, status: number, details: unknown, failureId?: number | null, failure?: HostFailure | null);
|
|
11
29
|
}
|
|
12
30
|
export declare class WorkflowFailure extends Error {
|
|
13
31
|
readonly status: number;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ResourceKeyWith } from "../data.js";
|
|
2
2
|
import type { ContentDocument } from "../input.js";
|
|
3
|
-
export declare const SDK_VERSION =
|
|
3
|
+
export declare const SDK_VERSION = 69;
|
|
4
4
|
export interface WorkspaceSystemFields {
|
|
5
5
|
"ai_custom_system_prompt": string | null;
|
|
6
6
|
"brand_kit": {
|
package/dist/http-transport.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
HostError
|
|
3
|
-
} from "./chunks/chunk-
|
|
3
|
+
} from "./chunks/chunk-XJOXCKID.js";
|
|
4
4
|
|
|
5
5
|
// packages/workflows/src/http-transport.ts
|
|
6
6
|
var HttpTransport = class {
|
|
@@ -39,7 +39,14 @@ var HttpTransport = class {
|
|
|
39
39
|
status: response.status,
|
|
40
40
|
details: null
|
|
41
41
|
};
|
|
42
|
-
throw new HostError(
|
|
42
|
+
throw new HostError(
|
|
43
|
+
error.message,
|
|
44
|
+
error.code,
|
|
45
|
+
error.status,
|
|
46
|
+
error.details,
|
|
47
|
+
null,
|
|
48
|
+
error.failure ?? null
|
|
49
|
+
);
|
|
43
50
|
}
|
|
44
51
|
return reply.value;
|
|
45
52
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import "./console.js";
|
|
2
2
|
export { HostError, WorkflowFailure, fail, validationError } from "./errors.js";
|
|
3
|
+
export type { HostFailure } from "./errors.js";
|
|
3
4
|
export { invoke, setTransport, type HostTransport } from "./transport.js";
|
|
4
5
|
export { transaction } from "./transaction.js";
|
|
5
6
|
export { data } from "./data.js";
|
package/dist/index.js
CHANGED
|
@@ -37,7 +37,7 @@ import {
|
|
|
37
37
|
web,
|
|
38
38
|
workflow,
|
|
39
39
|
workspace
|
|
40
|
-
} from "./chunks/chunk-
|
|
40
|
+
} from "./chunks/chunk-IQF5EEBK.js";
|
|
41
41
|
import {
|
|
42
42
|
InputField,
|
|
43
43
|
InputSchema,
|
|
@@ -49,13 +49,13 @@ import {
|
|
|
49
49
|
setTransport,
|
|
50
50
|
v,
|
|
51
51
|
validateWorkflowInput
|
|
52
|
-
} from "./chunks/chunk-
|
|
52
|
+
} from "./chunks/chunk-55XJDIQB.js";
|
|
53
53
|
import {
|
|
54
54
|
HostError,
|
|
55
55
|
WorkflowFailure,
|
|
56
56
|
fail,
|
|
57
57
|
validationError
|
|
58
|
-
} from "./chunks/chunk-
|
|
58
|
+
} from "./chunks/chunk-XJOXCKID.js";
|
|
59
59
|
|
|
60
60
|
// packages/workflows/src/notifications.ts
|
|
61
61
|
var mail2 = {
|
package/dist/profiles/test.js
CHANGED
|
@@ -35,7 +35,7 @@ import {
|
|
|
35
35
|
web,
|
|
36
36
|
workflow,
|
|
37
37
|
workspace
|
|
38
|
-
} from "../chunks/chunk-
|
|
38
|
+
} from "../chunks/chunk-IQF5EEBK.js";
|
|
39
39
|
import {
|
|
40
40
|
InputField,
|
|
41
41
|
InputSchema,
|
|
@@ -45,13 +45,13 @@ import {
|
|
|
45
45
|
respond,
|
|
46
46
|
v,
|
|
47
47
|
validateWorkflowInput
|
|
48
|
-
} from "../chunks/chunk-
|
|
48
|
+
} from "../chunks/chunk-55XJDIQB.js";
|
|
49
49
|
import {
|
|
50
50
|
HostError,
|
|
51
51
|
WorkflowFailure,
|
|
52
52
|
fail,
|
|
53
53
|
validationError
|
|
54
|
-
} from "../chunks/chunk-
|
|
54
|
+
} from "../chunks/chunk-XJOXCKID.js";
|
|
55
55
|
|
|
56
56
|
// packages/workflows/src/generated/profiles/test.ts
|
|
57
57
|
var ai2 = {
|
package/dist/testing/index.js
CHANGED
|
@@ -2,10 +2,10 @@ import {
|
|
|
2
2
|
parseWorkflowInput,
|
|
3
3
|
setTransport,
|
|
4
4
|
validateWorkflowInput
|
|
5
|
-
} from "../chunks/chunk-
|
|
5
|
+
} from "../chunks/chunk-55XJDIQB.js";
|
|
6
6
|
import {
|
|
7
7
|
HostError
|
|
8
|
-
} from "../chunks/chunk-
|
|
8
|
+
} from "../chunks/chunk-XJOXCKID.js";
|
|
9
9
|
|
|
10
10
|
// packages/workflows/src/testing/index.ts
|
|
11
11
|
import { AsyncLocalStorage } from "node:async_hooks";
|
package/package.json
CHANGED