@inhuman.tools/env-capability-module-prompt 0.2.0 → 0.3.0
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/bundle.d.ts +1 -1
- package/dist/bundle.d.ts.map +1 -1
- package/dist/run-isolated.d.ts +1 -1
- package/dist/run-isolated.d.ts.map +1 -1
- package/dist/run-isolated.js +1 -1
- package/dist/run-isolated.js.map +1 -1
- package/dist/run-program.d.ts +2 -2
- package/dist/run-program.d.ts.map +1 -1
- package/dist/run-program.js +8 -10
- package/dist/run-program.js.map +1 -1
- package/package.json +10 -10
- package/src/bundle.ts +1 -1
- package/src/dotprompt.ts +1 -1
- package/src/run-isolated.ts +6 -1
- package/src/run-program.ts +21 -19
package/dist/bundle.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* A ProgrammaticJob parents an omitted-spec AgentCallJob instead of calling the port.
|
|
4
4
|
*/
|
|
5
5
|
import type { ReasoningEffort } from "@inhuman.tools/env-capability-dotprompt";
|
|
6
|
-
import type { CompletionExpectation, PromptMessageRole } from "@inhuman.tools/harness-model";
|
|
6
|
+
import type { CompletionExpectation, PromptMessageRole } from "@inhuman.tools/harness-model/session";
|
|
7
7
|
/** Session/research intern port. Homed `round` is mutated in place. `responseSchemaJson` is the serialized schema, matching CompleteFields. */
|
|
8
8
|
export type PromptCompleteRequest = {
|
|
9
9
|
readonly connectionId: string;
|
package/dist/bundle.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bundle.d.ts","sourceRoot":"","sources":["../src/bundle.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yCAAyC,CAAC;AAC/E,OAAO,KAAK,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"bundle.d.ts","sourceRoot":"","sources":["../src/bundle.ts"],"names":[],"mappings":"AAAA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SAAS,MAAM,EAAE,GAAG,IAAI,EAC/B,QAAQ,EAAE,SAAS,CAAC,iBAAiB,EAAE,MAAM,CAAC,EAAE;CAEnE"}
|
package/dist/run-isolated.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { EnvCapability } from "@here.build/arrival";
|
|
|
6
6
|
import { Job } from "@inhuman.tools/plexus-expectations";
|
|
7
7
|
import { z } from "zod";
|
|
8
8
|
export declare const promptIsolatedCapability: EnvCapability<{
|
|
9
|
-
job: z.
|
|
9
|
+
job: z.ZodInstanceOf<Job<unknown, unknown>>;
|
|
10
10
|
connectionId: z.ZodString;
|
|
11
11
|
model: z.ZodOptional<z.ZodString>;
|
|
12
12
|
/** Session/judge model. `model` is reserved by some exec hosts. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-isolated.d.ts","sourceRoot":"","sources":["../src/run-isolated.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"run-isolated.d.ts","sourceRoot":"","sources":["../src/run-isolated.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AASpD,OAAO,EAAE,GAAG,EAAE,MAAM,oCAAoC,CAAC;AAEzD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,wBAAwB;;;;IAUjC,mEAAmE;;yBAqCrE,CAAC"}
|
package/dist/run-isolated.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import { EnvCapability } from "@here.build/arrival";
|
|
6
6
|
import { arrivalLoaderCapability } from "@here.build/arrival-modules";
|
|
7
7
|
import { dotpromptCapability, ParsedPrompt } from "@inhuman.tools/env-capability-dotprompt";
|
|
8
|
-
import { CompletionExpectation, CompletionJob, ProgrammaticJob, PromptMessage } from "@inhuman.tools/harness-model";
|
|
8
|
+
import { CompletionExpectation, CompletionJob, ProgrammaticJob, PromptMessage, } from "@inhuman.tools/harness-model/session";
|
|
9
9
|
import { Job } from "@inhuman.tools/plexus-expectations";
|
|
10
10
|
import invariant from "tiny-invariant";
|
|
11
11
|
import { z } from "zod";
|
package/dist/run-isolated.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-isolated.js","sourceRoot":"","sources":["../src/run-isolated.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;AAC5F,OAAO,
|
|
1
|
+
{"version":3,"file":"run-isolated.js","sourceRoot":"","sources":["../src/run-isolated.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;AAC5F,OAAO,EACL,qBAAqB,EACrB,aAAa,EACb,eAAe,EACf,aAAa,GACd,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,GAAG,EAAE,MAAM,oCAAoC,CAAC;AACzD,OAAO,SAAS,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE7D,MAAM,CAAC,MAAM,wBAAwB,GAAG,aAAa,CAAC,MAAM,CAAC,qBAAqB,EAAE;IAClF,IAAI,EAAE,CAAC,mBAAmB,EAAE,uBAAuB,CAAC;IACpD,aAAa,EAAE;QACb,GAAG,EAAE,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,M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S,CAAC,KAAK,IAAI,IAAI,EAAE,kCAAkC,CAAC,CAAC;YAC7D,6EAA6E;YAC7E,OAAO,MAAM,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,WAAW,CAC7C,IAAI,aAAa,CAAC;gBAChB,WAAW,EAAE,IAAI,qBAAqB,CAAC;oBACrC,YAAY,EAAE,IAAI,CAAC,aAAa,CAAC,YAAY;oBAC7C,KAAK;oBACL,cAAc,EAAE,MAAM,CAAC,cAAc;oBACrC,cAAc,EAAE,UAAU;oBAC1B,cAAc,EAAE,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,OAAO,CAAC,EAAE,EAAE,CAAC,IAAI,aAAa,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;oBAC9F,eAAe,EAAE,MAAM,CAAC,eAAe;iBACxC,CAAC;gBACF,QAAQ,EAAE,IAAI,CAAC,aAAa,CAAC,GAAG;aACjC,CAAC,CACH,CAAC;QACJ,CAAC,CACF;KACF,CAAC;IACF,OAAO,EAAE,aAAa;CACvB,CAAC,CAAC"}
|
package/dist/run-program.d.ts
CHANGED
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
* AgentCallJob on the ProgrammaticJob and waits for the worker.
|
|
4
4
|
*/
|
|
5
5
|
import { EnvCapability } from "@here.build/arrival";
|
|
6
|
-
import { ProgrammaticJob } from "@inhuman.tools/harness-model";
|
|
6
|
+
import { ProgrammaticJob } from "@inhuman.tools/harness-model/session";
|
|
7
7
|
import { z } from "zod";
|
|
8
8
|
export declare const promptProgramCapability: EnvCapability<{
|
|
9
|
-
job: z.
|
|
9
|
+
job: z.ZodInstanceOf<ProgrammaticJob>;
|
|
10
10
|
readonly: z.ZodDefault<z.ZodBoolean>;
|
|
11
11
|
}, Record<string, never>>;
|
|
12
12
|
//# sourceMappingURL=run-program.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-program.d.ts","sourceRoot":"","sources":["../src/run-program.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGpD,OAAO,EAML,eAAe,EAGhB,MAAM,
|
|
1
|
+
{"version":3,"file":"run-program.d.ts","sourceRoot":"","sources":["../src/run-program.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGpD,OAAO,EAML,eAAe,EAGhB,MAAM,sCAAsC,CAAC;AAE9C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB,eAAO,MAAM,uBAAuB;;;yBAuDlC,CAAC"}
|
package/dist/run-program.js
CHANGED
|
@@ -5,10 +5,11 @@
|
|
|
5
5
|
import { EnvCapability } from "@here.build/arrival";
|
|
6
6
|
import { arrivalLoaderCapability } from "@here.build/arrival-modules";
|
|
7
7
|
import { dotpromptCapability, ParsedPrompt } from "@inhuman.tools/env-capability-dotprompt";
|
|
8
|
-
import { AgentCallJob, claimCrossing, crossingPending, crossingWindow, isReplaying, ProgrammaticJob, PromptMessage, takeCrossing, } from "@inhuman.tools/harness-model";
|
|
9
|
-
import {
|
|
8
|
+
import { AgentCallJob, claimCrossing, crossingPending, crossingWindow, isReplaying, ProgrammaticJob, PromptMessage, takeCrossing, } from "@inhuman.tools/harness-model/session";
|
|
9
|
+
import { when } from "mobx";
|
|
10
10
|
import { z } from "zod";
|
|
11
11
|
import { promptPrelude, renderPrompt } from "./dotprompt.js";
|
|
12
|
+
import invariant from "tiny-invariant";
|
|
12
13
|
const AGENT_ASK = "agent__ask";
|
|
13
14
|
export const promptProgramCapability = EnvCapability.define("ext/prompt/program", {
|
|
14
15
|
deps: [dotpromptCapability, arrivalLoaderCapability],
|
|
@@ -23,7 +24,6 @@ export const promptProgramCapability = EnvCapability.define("ext/prompt/program"
|
|
|
23
24
|
provenance: "source",
|
|
24
25
|
requiresConfig: ["job"],
|
|
25
26
|
}, async function (spec, args) {
|
|
26
|
-
const bundle = renderPrompt(spec, args);
|
|
27
27
|
const job = this.configuration.job;
|
|
28
28
|
const emission = this.runCtx.emission;
|
|
29
29
|
const path = job.trackMatch && emission != null ? claimCrossing(emission, crossingWindow(this)) : "";
|
|
@@ -40,13 +40,13 @@ export const promptProgramCapability = EnvCapability.define("ext/prompt/program"
|
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
existing = takeCrossing(job, emission, path);
|
|
43
|
-
|
|
44
|
-
throw new Error("replay: no recorded dotprompt/run");
|
|
43
|
+
invariant(existing != null, "replay: no recorded dotprompt/run");
|
|
45
44
|
}
|
|
46
45
|
if (existing != null)
|
|
47
46
|
return await existing;
|
|
48
47
|
}
|
|
49
|
-
const
|
|
48
|
+
const bundle = renderPrompt(spec, args);
|
|
49
|
+
return await job.registerJob(new AgentCallJob({
|
|
50
50
|
toolCallId: `${job.toolCallId}:prompt:${job.children.length + 1}`,
|
|
51
51
|
name: AGENT_ASK,
|
|
52
52
|
argsJson: "{}",
|
|
@@ -58,10 +58,8 @@ export const promptProgramCapability = EnvCapability.define("ext/prompt/program"
|
|
|
58
58
|
tools: bundle.tools ?? [],
|
|
59
59
|
inheritCallerTools: bundle.tools === null,
|
|
60
60
|
reasoningEffort: bundle.reasoningEffort,
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
runInAction(() => (minted.track = path));
|
|
64
|
-
return await job.registerJob(minted);
|
|
61
|
+
track: path !== "" ? path : undefined,
|
|
62
|
+
}));
|
|
65
63
|
}),
|
|
66
64
|
}),
|
|
67
65
|
prelude: promptPrelude,
|
package/dist/run-program.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-program.js","sourceRoot":"","sources":["../src/run-program.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AACtE,OAAO,E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3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Arrival ext/prompt: (require \"x.prompt\") pretreats to a scheme lambda; a ProgrammaticJob parents an omitted-spec agent ask.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -20,21 +20,21 @@
|
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@here.build/arrival": "^0.10.2",
|
|
22
22
|
"@here.build/arrival-modules": "^0.10.0",
|
|
23
|
-
"handlebars": "^4.7.
|
|
23
|
+
"handlebars": "^4.7.10",
|
|
24
24
|
"tiny-invariant": "^1.3.3",
|
|
25
|
-
"zod": "^4.
|
|
25
|
+
"zod": "^4.6.7",
|
|
26
26
|
"@inhuman.tools/env-capability-dotprompt": "^0.2.0",
|
|
27
|
-
"@inhuman.tools/harness-
|
|
28
|
-
"@inhuman.tools/harness-
|
|
29
|
-
"@inhuman.tools/plexus-expectations": "^0.
|
|
27
|
+
"@inhuman.tools/harness-commons": "^0.3.0",
|
|
28
|
+
"@inhuman.tools/harness-model": "^0.3.0",
|
|
29
|
+
"@inhuman.tools/plexus-expectations": "^0.3.0"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@types/node": "^24.
|
|
32
|
+
"@types/node": "^24.19.2",
|
|
33
33
|
"dedent": "1.7.2",
|
|
34
|
-
"eslint": "
|
|
34
|
+
"eslint": "10.13.0",
|
|
35
35
|
"mobx": "6.16.1",
|
|
36
|
-
"typescript": "6.0.
|
|
37
|
-
"vitest": "
|
|
36
|
+
"typescript": "6.0.3",
|
|
37
|
+
"vitest": "5.0.5",
|
|
38
38
|
"@-internal-/eslint-configs": "0.0.0"
|
|
39
39
|
},
|
|
40
40
|
"license": "MIT",
|
package/src/bundle.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* A ProgrammaticJob parents an omitted-spec AgentCallJob instead of calling the port.
|
|
4
4
|
*/
|
|
5
5
|
import type { ReasoningEffort } from "@inhuman.tools/env-capability-dotprompt";
|
|
6
|
-
import type { CompletionExpectation, PromptMessageRole } from "@inhuman.tools/harness-model";
|
|
6
|
+
import type { CompletionExpectation, PromptMessageRole } from "@inhuman.tools/harness-model/session";
|
|
7
7
|
|
|
8
8
|
/** Session/research intern port. Homed `round` is mutated in place. `responseSchemaJson` is the serialized schema, matching CompleteFields. */
|
|
9
9
|
export type PromptCompleteRequest = {
|
package/src/dotprompt.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import { type SchemeValue, toJS } from "@here.build/arrival";
|
|
6
6
|
import { compileTemplate, runCompiledTemplate } from "@here.build/arrival-modules/handlebars";
|
|
7
7
|
import { isPlainRecord, type ParsedPrompt, reasoningEffortSchema } from "@inhuman.tools/env-capability-dotprompt";
|
|
8
|
-
import { type PromptMessageRole } from "@inhuman.tools/harness-model";
|
|
8
|
+
import { type PromptMessageRole } from "@inhuman.tools/harness-model/session";
|
|
9
9
|
import invariant from "tiny-invariant";
|
|
10
10
|
import { z } from "zod";
|
|
11
11
|
|
package/src/run-isolated.ts
CHANGED
|
@@ -5,7 +5,12 @@
|
|
|
5
5
|
import { EnvCapability } from "@here.build/arrival";
|
|
6
6
|
import { arrivalLoaderCapability } from "@here.build/arrival-modules";
|
|
7
7
|
import { dotpromptCapability, ParsedPrompt } from "@inhuman.tools/env-capability-dotprompt";
|
|
8
|
-
import {
|
|
8
|
+
import {
|
|
9
|
+
CompletionExpectation,
|
|
10
|
+
CompletionJob,
|
|
11
|
+
ProgrammaticJob,
|
|
12
|
+
PromptMessage,
|
|
13
|
+
} from "@inhuman.tools/harness-model/session";
|
|
9
14
|
import { Job } from "@inhuman.tools/plexus-expectations";
|
|
10
15
|
import invariant from "tiny-invariant";
|
|
11
16
|
import { z } from "zod";
|
package/src/run-program.ts
CHANGED
|
@@ -14,11 +14,12 @@ import {
|
|
|
14
14
|
ProgrammaticJob,
|
|
15
15
|
PromptMessage,
|
|
16
16
|
takeCrossing,
|
|
17
|
-
} from "@inhuman.tools/harness-model";
|
|
18
|
-
import {
|
|
17
|
+
} from "@inhuman.tools/harness-model/session";
|
|
18
|
+
import { when } from "mobx";
|
|
19
19
|
import { z } from "zod";
|
|
20
20
|
|
|
21
21
|
import { promptPrelude, renderPrompt } from "./dotprompt.js";
|
|
22
|
+
import invariant from "tiny-invariant";
|
|
22
23
|
|
|
23
24
|
const AGENT_ASK = "agent__ask";
|
|
24
25
|
|
|
@@ -37,7 +38,6 @@ export const promptProgramCapability = EnvCapability.define("ext/prompt/program"
|
|
|
37
38
|
requiresConfig: ["job"],
|
|
38
39
|
},
|
|
39
40
|
async function (spec, args) {
|
|
40
|
-
const bundle = renderPrompt(spec, args);
|
|
41
41
|
const job = this.configuration.job;
|
|
42
42
|
const emission = this.runCtx.emission;
|
|
43
43
|
const path = job.trackMatch && emission != null ? claimCrossing(emission, crossingWindow(this)) : "";
|
|
@@ -53,25 +53,27 @@ export const promptProgramCapability = EnvCapability.define("ext/prompt/program"
|
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
existing = takeCrossing(job, emission, path);
|
|
56
|
-
|
|
56
|
+
invariant(existing != null, "replay: no recorded dotprompt/run");
|
|
57
57
|
}
|
|
58
58
|
if (existing != null) return await existing;
|
|
59
59
|
}
|
|
60
|
-
const
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
60
|
+
const bundle = renderPrompt(spec, args);
|
|
61
|
+
return await job.registerJob(
|
|
62
|
+
new AgentCallJob({
|
|
63
|
+
toolCallId: `${job.toolCallId}:prompt:${job.children.length + 1}`,
|
|
64
|
+
name: AGENT_ASK,
|
|
65
|
+
argsJson: "{}",
|
|
66
|
+
voidLegal: false,
|
|
67
|
+
readonly: this.configuration.readonly === true,
|
|
68
|
+
responseSchema: bundle.responseSchema,
|
|
69
|
+
promptMessages: bundle.messages.map(([role, content]) => new PromptMessage({ role, content })),
|
|
70
|
+
faceName: bundle.faceName.trim(),
|
|
71
|
+
tools: bundle.tools ?? [],
|
|
72
|
+
inheritCallerTools: bundle.tools === null,
|
|
73
|
+
reasoningEffort: bundle.reasoningEffort,
|
|
74
|
+
track: path !== "" ? path : undefined,
|
|
75
|
+
}),
|
|
76
|
+
);
|
|
75
77
|
},
|
|
76
78
|
),
|
|
77
79
|
}),
|