@agentswf/contract 0.0.0-stage → 0.1.0-beta.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/package.json +32 -4
- package/src/call.ts +6 -0
- package/src/index.ts +4 -0
- package/src/participant.ts +15 -0
- package/src/records.ts +893 -0
- package/src/records.typecheck.ts +5 -0
- package/src/schema.ts +342 -0
- package/src/semantic.ts +15 -0
- package/src/testing/fixtures.ts +11 -0
- package/src/wire.ts +578 -0
- package/src/workflow/agents.ts +427 -0
- package/src/workflow/composition.ts +18 -0
- package/src/workflow/deadlines.typecheck.ts +76 -0
- package/src/workflow/decisions.ts +176 -0
- package/src/workflow/decisions.typecheck.ts +97 -0
- package/src/workflow/executable.ts +87 -0
- package/src/workflow/index.ts +10 -0
- package/src/workflow/json.ts +74 -0
- package/src/workflow/messaging.ts +31 -0
- package/src/workflow/messaging.typecheck.ts +114 -0
- package/src/workflow/participants.ts +33 -0
- package/src/workflow/sandboxes.ts +87 -0
- package/src/workflow/sandboxes.typecheck.ts +64 -0
- package/src/workflow/timing.ts +14 -0
- package/src/workflow/workflow.ts +128 -0
- package/README.md +0 -3
package/package.json
CHANGED
|
@@ -1,6 +1,34 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentswf/contract",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.0-beta.1",
|
|
4
|
+
"description": "agents.wf: types, schemas and record formats shared by its packages",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"homepage": "https://github.com/romanlv/agentswf",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/romanlv/agentswf.git",
|
|
10
|
+
"directory": "packages/contract"
|
|
11
|
+
},
|
|
12
|
+
"type": "module",
|
|
13
|
+
"engines": {
|
|
14
|
+
"bun": ">=1.4.0"
|
|
15
|
+
},
|
|
16
|
+
"exports": {
|
|
17
|
+
".": "./src/index.ts",
|
|
18
|
+
"./schema": "./src/schema.ts",
|
|
19
|
+
"./records": "./src/records.ts",
|
|
20
|
+
"./wire": "./src/wire.ts",
|
|
21
|
+
"./participant": "./src/participant.ts",
|
|
22
|
+
"./workflow": "./src/workflow/index.ts",
|
|
23
|
+
"./testing": "./src/testing/fixtures.ts"
|
|
24
|
+
},
|
|
25
|
+
"files": [
|
|
26
|
+
"src",
|
|
27
|
+
"!src/**/*.test.ts",
|
|
28
|
+
"!src/**/*.eval.ts",
|
|
29
|
+
"!src/**/fixtures"
|
|
30
|
+
],
|
|
31
|
+
"publishConfig": {
|
|
32
|
+
"access": "public"
|
|
33
|
+
}
|
|
34
|
+
}
|
package/src/call.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** Only `answered` carries a value: a turn that produced nothing cannot be read as data. */
|
|
2
|
+
export type CallResult =
|
|
3
|
+
| { kind: "answered"; value: unknown }
|
|
4
|
+
| { kind: "finished"; reason: string }
|
|
5
|
+
| { kind: "blocked"; reason: string }
|
|
6
|
+
| { kind: "failed"; reason: string };
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ParticipantKey, ParticipantRef } from "./workflow/participants";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* What makes a `ParticipantRef` one the engine issued. Exported only through
|
|
5
|
+
* `@agentswf/contract/participant`, which a workflow cannot import, so a `{ key }` literal does not
|
|
6
|
+
* type-check as a ref.
|
|
7
|
+
*/
|
|
8
|
+
export const PARTICIPANT: unique symbol = Symbol("agentswf.participant");
|
|
9
|
+
|
|
10
|
+
/** A ref for a participant the engine opened. */
|
|
11
|
+
export function participantRef<K extends ParticipantKey>(
|
|
12
|
+
key: K,
|
|
13
|
+
): ParticipantRef & { readonly key: K } {
|
|
14
|
+
return { key, [PARTICIPANT]: true };
|
|
15
|
+
}
|