@a5c-ai/babysitter-sdk 5.0.1-staging.ca65e187 → 5.0.1-staging.d09ca951
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.
|
@@ -31,7 +31,7 @@ export const agentTask = defineTask('agent-scorer', (args, taskCtx) => ({
|
|
|
31
31
|
},
|
|
32
32
|
|
|
33
33
|
io: {
|
|
34
|
-
inputJsonPath: `tasks/${taskCtx.effectId}/
|
|
34
|
+
inputJsonPath: `tasks/${taskCtx.effectId}/inputs.json`,
|
|
35
35
|
outputJsonPath: `tasks/${taskCtx.effectId}/output.json`
|
|
36
36
|
}
|
|
37
37
|
}));
|
|
@@ -54,7 +54,7 @@ export const grepCheckTask = defineTask('grep-integration-check', (args, taskCtx
|
|
|
54
54
|
timeout: 10000
|
|
55
55
|
},
|
|
56
56
|
io: {
|
|
57
|
-
inputJsonPath: `tasks/${taskCtx.effectId}/
|
|
57
|
+
inputJsonPath: `tasks/${taskCtx.effectId}/inputs.json`,
|
|
58
58
|
outputJsonPath: `tasks/${taskCtx.effectId}/output.json`
|
|
59
59
|
}
|
|
60
60
|
}));
|
|
@@ -74,7 +74,7 @@ export const verificationGateTask = defineTask('verification-gate', (args, taskC
|
|
|
74
74
|
timeout: 300000
|
|
75
75
|
},
|
|
76
76
|
io: {
|
|
77
|
-
inputJsonPath: `tasks/${taskCtx.effectId}/
|
|
77
|
+
inputJsonPath: `tasks/${taskCtx.effectId}/inputs.json`,
|
|
78
78
|
outputJsonPath: `tasks/${taskCtx.effectId}/output.json`
|
|
79
79
|
}
|
|
80
80
|
}));
|
|
@@ -103,7 +103,7 @@ export const readSpecTask = defineTask('read-spec', (args, taskCtx) => ({
|
|
|
103
103
|
timeout: 5000,
|
|
104
104
|
},
|
|
105
105
|
io: {
|
|
106
|
-
inputJsonPath: `tasks/${taskCtx.effectId}/
|
|
106
|
+
inputJsonPath: `tasks/${taskCtx.effectId}/inputs.json`,
|
|
107
107
|
outputJsonPath: `tasks/${taskCtx.effectId}/output.json`,
|
|
108
108
|
},
|
|
109
109
|
}));
|
|
@@ -141,7 +141,7 @@ export const authorTestsFromSpecTask = defineTask(
|
|
|
141
141
|
},
|
|
142
142
|
},
|
|
143
143
|
io: {
|
|
144
|
-
inputJsonPath: `tasks/${taskCtx.effectId}/
|
|
144
|
+
inputJsonPath: `tasks/${taskCtx.effectId}/inputs.json`,
|
|
145
145
|
outputJsonPath: `tasks/${taskCtx.effectId}/output.json`,
|
|
146
146
|
},
|
|
147
147
|
}),
|
|
@@ -178,7 +178,7 @@ export const verifyAgainstSpecTask = defineTask(
|
|
|
178
178
|
},
|
|
179
179
|
},
|
|
180
180
|
io: {
|
|
181
|
-
inputJsonPath: `tasks/${taskCtx.effectId}/
|
|
181
|
+
inputJsonPath: `tasks/${taskCtx.effectId}/inputs.json`,
|
|
182
182
|
outputJsonPath: `tasks/${taskCtx.effectId}/output.json`,
|
|
183
183
|
},
|
|
184
184
|
}),
|
|
@@ -222,7 +222,7 @@ export const skillTask = defineTask('analyzer-skill', (args, taskCtx) => ({
|
|
|
222
222
|
},
|
|
223
223
|
|
|
224
224
|
io: {
|
|
225
|
-
inputJsonPath: `tasks/${taskCtx.effectId}/
|
|
225
|
+
inputJsonPath: `tasks/${taskCtx.effectId}/inputs.json`,
|
|
226
226
|
outputJsonPath: `tasks/${taskCtx.effectId}/output.json`
|
|
227
227
|
}
|
|
228
228
|
}));
|
|
@@ -99,7 +99,7 @@ defineTask('my-task', (args, taskCtx) => ({
|
|
|
99
99
|
outputSchema: { type: 'object', required: ['result'] }
|
|
100
100
|
},
|
|
101
101
|
io: {
|
|
102
|
-
inputJsonPath: `tasks/${taskCtx.effectId}/
|
|
102
|
+
inputJsonPath: `tasks/${taskCtx.effectId}/inputs.json`,
|
|
103
103
|
outputJsonPath: `tasks/${taskCtx.effectId}/result.json`
|
|
104
104
|
}
|
|
105
105
|
}));
|
|
@@ -5,5 +5,33 @@ export interface DefineTaskOptions {
|
|
|
5
5
|
kind?: string;
|
|
6
6
|
source?: string;
|
|
7
7
|
}
|
|
8
|
+
/**
|
|
9
|
+
* Backward-compatible single-object form accepted by defineTask.
|
|
10
|
+
* Two flavors are recognized:
|
|
11
|
+
* 1. Static TaskDef shape: { id|name, kind, title, labels, ...rest } — the
|
|
12
|
+
* whole object (minus id/name/run/source/inputs/outputs) is treated as a
|
|
13
|
+
* static TaskDef returned for every invocation.
|
|
14
|
+
* 2. Run-function shape: { id|name, run(args, ctx) -> TaskDef|Promise<TaskDef>,
|
|
15
|
+
* description?, labels?, kind?, source?, inputs?, outputs? } — `run` is
|
|
16
|
+
* used as the impl. `inputs`/`outputs` schemas are stored as metadata for
|
|
17
|
+
* tooling but are not enforced at runtime.
|
|
18
|
+
*
|
|
19
|
+
* This shape is used by ~75 library/contrib and library/methodologies files
|
|
20
|
+
* authored against an earlier SDK API; supporting it here keeps those processes
|
|
21
|
+
* runnable without per-file rewrites.
|
|
22
|
+
*/
|
|
23
|
+
export interface DefineTaskObjectSpec<TArgs = unknown, TResult = unknown> {
|
|
24
|
+
id?: string;
|
|
25
|
+
name?: string;
|
|
26
|
+
description?: string;
|
|
27
|
+
labels?: string[];
|
|
28
|
+
kind?: string;
|
|
29
|
+
source?: string;
|
|
30
|
+
run?: TaskImpl<TArgs, TResult>;
|
|
31
|
+
inputs?: Record<string, unknown>;
|
|
32
|
+
outputs?: Record<string, unknown>;
|
|
33
|
+
[key: string]: unknown;
|
|
34
|
+
}
|
|
8
35
|
export declare function defineTask<TArgs = unknown, TResult = unknown>(id: string, impl: TaskImpl<TArgs, TResult>, options?: DefineTaskOptions): DefinedTask<TArgs, TResult>;
|
|
36
|
+
export declare function defineTask<TArgs = unknown, TResult = unknown>(spec: DefineTaskObjectSpec<TArgs, TResult>): DefinedTask<TArgs, TResult>;
|
|
9
37
|
//# sourceMappingURL=defineTask.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defineTask.d.ts","sourceRoot":"","sources":["../../src/tasks/defineTask.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAA6B,QAAQ,EAAE,MAAM,SAAS,CAAC;AAE3E,MAAM,WAAW,iBAAiB;IAChC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,wBAAgB,UAAU,CAAC,KAAK,GAAG,OAAO,EAAE,OAAO,GAAG,OAAO,EAC3D,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC,EAC9B,OAAO,
|
|
1
|
+
{"version":3,"file":"defineTask.d.ts","sourceRoot":"","sources":["../../src/tasks/defineTask.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAA6B,QAAQ,EAAE,MAAM,SAAS,CAAC;AAE3E,MAAM,WAAW,iBAAiB;IAChC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,oBAAoB,CAAC,KAAK,GAAG,OAAO,EAAE,OAAO,GAAG,OAAO;IACtE,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IAC/B,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAElC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,wBAAgB,UAAU,CAAC,KAAK,GAAG,OAAO,EAAE,OAAO,GAAG,OAAO,EAC3D,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC,EAC9B,OAAO,CAAC,EAAE,iBAAiB,GAC1B,WAAW,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;AAC/B,wBAAgB,UAAU,CAAC,KAAK,GAAG,OAAO,EAAE,OAAO,GAAG,OAAO,EAC3D,IAAI,EAAE,oBAAoB,CAAC,KAAK,EAAE,OAAO,CAAC,GACzC,WAAW,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC"}
|
package/dist/tasks/defineTask.js
CHANGED
|
@@ -2,7 +2,17 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.defineTask = defineTask;
|
|
4
4
|
const registry_1 = require("./registry");
|
|
5
|
-
function defineTask(
|
|
5
|
+
function defineTask(idOrSpec, maybeImpl, maybeOptions = {}) {
|
|
6
|
+
// Object-form dispatch: defineTask({ id|name, ..., run? })
|
|
7
|
+
if (typeof idOrSpec === "object" && idOrSpec !== null) {
|
|
8
|
+
return defineTaskFromObject(idOrSpec);
|
|
9
|
+
}
|
|
10
|
+
const id = idOrSpec;
|
|
11
|
+
const impl = maybeImpl;
|
|
12
|
+
const options = maybeOptions;
|
|
13
|
+
if (typeof impl !== "function") {
|
|
14
|
+
throw new Error("defineTask positional form requires (id, impl) where impl is a function returning a TaskDef");
|
|
15
|
+
}
|
|
6
16
|
const taskId = normalizeTaskId(id);
|
|
7
17
|
registerTaskId(taskId, options);
|
|
8
18
|
const defined = {
|
|
@@ -44,6 +54,37 @@ function normalizeTaskId(id) {
|
|
|
44
54
|
}
|
|
45
55
|
return id.trim();
|
|
46
56
|
}
|
|
57
|
+
function defineTaskFromObject(spec) {
|
|
58
|
+
const taskId = spec.id ?? spec.name;
|
|
59
|
+
if (typeof taskId !== "string" || !taskId.trim()) {
|
|
60
|
+
throw new Error("defineTask object form requires a non-empty `id` or `name` string");
|
|
61
|
+
}
|
|
62
|
+
const options = {
|
|
63
|
+
description: spec.description,
|
|
64
|
+
labels: spec.labels,
|
|
65
|
+
kind: spec.kind,
|
|
66
|
+
source: spec.source,
|
|
67
|
+
};
|
|
68
|
+
let impl;
|
|
69
|
+
if (typeof spec.run === "function") {
|
|
70
|
+
// Flavor (2): defineTask({ id|name, run, ... })
|
|
71
|
+
impl = spec.run;
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
// Flavor (1): static TaskDef. Everything except SDK-recognized envelope
|
|
75
|
+
// fields becomes the static TaskDef.
|
|
76
|
+
const { id: _id, name: _name, run: _run, inputs: _inputs, outputs: _outputs, source: _source, ...rest } = spec;
|
|
77
|
+
void _id;
|
|
78
|
+
void _name;
|
|
79
|
+
void _run;
|
|
80
|
+
void _inputs;
|
|
81
|
+
void _outputs;
|
|
82
|
+
void _source;
|
|
83
|
+
const staticTaskDef = rest;
|
|
84
|
+
impl = (() => staticTaskDef);
|
|
85
|
+
}
|
|
86
|
+
return defineTask(taskId, impl, options);
|
|
87
|
+
}
|
|
47
88
|
function normalizeTaskDef(taskDef) {
|
|
48
89
|
if (!taskDef || typeof taskDef !== "object") {
|
|
49
90
|
throw new Error("Task implementations must return a TaskDef object");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@a5c-ai/babysitter-sdk",
|
|
3
|
-
"version": "5.0.1-staging.
|
|
3
|
+
"version": "5.0.1-staging.d09ca951",
|
|
4
4
|
"description": "Storage and run-registry primitives for event-sourced babysitter workflows.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "commonjs",
|
|
@@ -39,8 +39,8 @@
|
|
|
39
39
|
"smoke:cli": "node scripts/smoke-cli.js --runs-dir packages/sdk/test-fixtures/cli/runs/smoke"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@a5c-ai/agent-catalog": "
|
|
43
|
-
"@a5c-ai/agent-mux": "
|
|
42
|
+
"@a5c-ai/agent-catalog": "5.0.1-staging.d09ca951",
|
|
43
|
+
"@a5c-ai/agent-mux": "0.4.10-staging.d09ca951",
|
|
44
44
|
"@modelcontextprotocol/sdk": "^1.12.1",
|
|
45
45
|
"@sinclair/typebox": "^0.34.48",
|
|
46
46
|
"zod": "^4.0.0",
|