@executioncontrolprotocol/core 0.13.1 → 0.13.2
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/definitions/capability.d.ts +7 -1
- package/dist/definitions/capability.d.ts.map +1 -1
- package/dist/definitions/capability.js +11 -0
- package/dist/definitions/capability.js.map +1 -1
- package/dist/definitions/extension.d.ts +7 -1
- package/dist/definitions/extension.d.ts.map +1 -1
- package/dist/definitions/extension.js +11 -0
- package/dist/definitions/extension.js.map +1 -1
- package/dist/definitions/types.d.ts +5 -1
- package/dist/definitions/types.d.ts.map +1 -1
- package/dist/environment/describe.d.ts +19 -1
- package/dist/environment/describe.d.ts.map +1 -1
- package/dist/environment/describe.js +172 -28
- package/dist/environment/describe.js.map +1 -1
- package/dist/environment/environment.d.ts.map +1 -1
- package/dist/environment/environment.js +4 -1
- package/dist/environment/environment.js.map +1 -1
- package/dist/environment/search.d.ts.map +1 -1
- package/dist/environment/search.js +26 -6
- package/dist/environment/search.js.map +1 -1
- package/dist/formats/format-fluent.d.ts.map +1 -1
- package/dist/formats/format-fluent.js +16 -0
- package/dist/formats/format-fluent.js.map +1 -1
- package/dist/formats/format-json.d.ts.map +1 -1
- package/dist/formats/format-json.js +28 -0
- package/dist/formats/format-json.js.map +1 -1
- package/dist/harness/authoring/chat-result.d.ts +19 -0
- package/dist/harness/authoring/chat-result.d.ts.map +1 -0
- package/dist/harness/authoring/chat-result.js +56 -0
- package/dist/harness/authoring/chat-result.js.map +1 -0
- package/dist/harness/authoring/classified-intent.d.ts +3 -3
- package/dist/harness/authoring/classified-intent.d.ts.map +1 -1
- package/dist/harness/authoring/classified-intent.js +68 -36
- package/dist/harness/authoring/classified-intent.js.map +1 -1
- package/dist/harness/authoring/context-policy.d.ts +3 -1
- package/dist/harness/authoring/context-policy.d.ts.map +1 -1
- package/dist/harness/authoring/context-policy.js +33 -5
- package/dist/harness/authoring/context-policy.js.map +1 -1
- package/dist/harness/authoring/describe-for-prompt.d.ts +19 -0
- package/dist/harness/authoring/describe-for-prompt.d.ts.map +1 -0
- package/dist/harness/authoring/describe-for-prompt.js +105 -0
- package/dist/harness/authoring/describe-for-prompt.js.map +1 -0
- package/dist/harness/authoring/index.d.ts +7 -2
- package/dist/harness/authoring/index.d.ts.map +1 -1
- package/dist/harness/authoring/index.js +6 -1
- package/dist/harness/authoring/index.js.map +1 -1
- package/dist/harness/authoring/normalize-patch-eql-output.d.ts.map +1 -1
- package/dist/harness/authoring/normalize-patch-eql-output.js +3 -1
- package/dist/harness/authoring/normalize-patch-eql-output.js.map +1 -1
- package/dist/harness/authoring/patch-clear-intent.d.ts +17 -0
- package/dist/harness/authoring/patch-clear-intent.d.ts.map +1 -0
- package/dist/harness/authoring/patch-clear-intent.js +46 -0
- package/dist/harness/authoring/patch-clear-intent.js.map +1 -0
- package/dist/harness/authoring/presentation.d.ts +7 -1
- package/dist/harness/authoring/presentation.d.ts.map +1 -1
- package/dist/harness/authoring/presentation.js +8 -2
- package/dist/harness/authoring/presentation.js.map +1 -1
- package/dist/harness/authoring/recover-structured-patch.d.ts.map +1 -1
- package/dist/harness/authoring/recover-structured-patch.js +34 -1
- package/dist/harness/authoring/recover-structured-patch.js.map +1 -1
- package/dist/harness/authoring/safe-reply.d.ts +28 -1
- package/dist/harness/authoring/safe-reply.d.ts.map +1 -1
- package/dist/harness/authoring/safe-reply.js +109 -5
- package/dist/harness/authoring/safe-reply.js.map +1 -1
- package/dist/harness/authoring/summarize-environment.d.ts +9 -1
- package/dist/harness/authoring/summarize-environment.d.ts.map +1 -1
- package/dist/harness/authoring/summarize-environment.js +90 -1
- package/dist/harness/authoring/summarize-environment.js.map +1 -1
- package/dist/harness/authoring/summarize-probe-context.d.ts +31 -0
- package/dist/harness/authoring/summarize-probe-context.d.ts.map +1 -0
- package/dist/harness/authoring/summarize-probe-context.js +134 -0
- package/dist/harness/authoring/summarize-probe-context.js.map +1 -0
- package/dist/harness/authoring/summarize-workflow.d.ts.map +1 -1
- package/dist/harness/authoring/summarize-workflow.js +1 -1
- package/dist/harness/authoring/summarize-workflow.js.map +1 -1
- package/dist/harness/authoring/to-provider-chat-turns.d.ts +42 -0
- package/dist/harness/authoring/to-provider-chat-turns.d.ts.map +1 -0
- package/dist/harness/authoring/to-provider-chat-turns.js +53 -0
- package/dist/harness/authoring/to-provider-chat-turns.js.map +1 -0
- package/dist/harness/prompts/build-repair-hint.d.ts +1 -0
- package/dist/harness/prompts/build-repair-hint.d.ts.map +1 -1
- package/dist/harness/prompts/build-repair-hint.js +11 -7
- package/dist/harness/prompts/build-repair-hint.js.map +1 -1
- package/dist/harness/prompts/eql-primer.d.ts.map +1 -1
- package/dist/harness/prompts/eql-primer.js +56 -28
- package/dist/harness/prompts/eql-primer.js.map +1 -1
- package/dist/harness/prompts/typescript-primer.d.ts.map +1 -1
- package/dist/harness/prompts/typescript-primer.js +21 -8
- package/dist/harness/prompts/typescript-primer.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/schema/json-schema.d.ts +1 -0
- package/dist/schema/json-schema.d.ts.map +1 -1
- package/dist/schema/json-schema.js +72 -30
- package/dist/schema/json-schema.js.map +1 -1
- package/dist/schema/workflow-io.d.ts +1 -1
- package/dist/schema/workflow-io.d.ts.map +1 -1
- package/dist/schema/workflow-io.js +9 -1
- package/dist/schema/workflow-io.js.map +1 -1
- package/dist/testing/test-extension.d.ts.map +1 -1
- package/dist/testing/test-extension.js +76 -0
- package/dist/testing/test-extension.js.map +1 -1
- package/dist/testing/test-lifecycle-extension.d.ts.map +1 -1
- package/dist/testing/test-lifecycle-extension.js +40 -0
- package/dist/testing/test-lifecycle-extension.js.map +1 -1
- package/package.json +6 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../src/environment/search.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../src/environment/search.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,qBAAqB,EACrB,aAAa,EACb,YAAY,EAEb,MAAM,iCAAiC,CAAA;AAyCxC,yDAAyD;AACzD,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,MAAM,EACb,UAAU,EAAE,qBAAqB,EACjC,OAAO,CAAC,EAAE,aAAa,GACtB,YAAY,CA8Dd"}
|
|
@@ -13,6 +13,29 @@ function scoreText(text, tokens) {
|
|
|
13
13
|
}
|
|
14
14
|
return matched / tokens.length;
|
|
15
15
|
}
|
|
16
|
+
function capabilityHaystack(cap) {
|
|
17
|
+
const meta = cap.metadata;
|
|
18
|
+
return [
|
|
19
|
+
cap.id,
|
|
20
|
+
cap.label ?? "",
|
|
21
|
+
cap.extension ?? "",
|
|
22
|
+
cap.summary ?? "",
|
|
23
|
+
meta?.description ?? "",
|
|
24
|
+
...(meta?.useCases ?? []),
|
|
25
|
+
...(meta?.samplePrompts ?? []),
|
|
26
|
+
].join(" ");
|
|
27
|
+
}
|
|
28
|
+
function extensionHaystack(ext) {
|
|
29
|
+
const meta = ext.metadata;
|
|
30
|
+
return [
|
|
31
|
+
ext.id,
|
|
32
|
+
ext.label ?? "",
|
|
33
|
+
ext.summary ?? "",
|
|
34
|
+
meta?.description ?? "",
|
|
35
|
+
...(meta?.useCases ?? []),
|
|
36
|
+
...(meta?.samplePrompts ?? []),
|
|
37
|
+
].join(" ");
|
|
38
|
+
}
|
|
16
39
|
/** Fuzzy search over environment descriptor sections. */
|
|
17
40
|
export function searchCapabilities(query, descriptor, options) {
|
|
18
41
|
const tokens = tokenize(query);
|
|
@@ -20,17 +43,15 @@ export function searchCapabilities(query, descriptor, options) {
|
|
|
20
43
|
const results = [];
|
|
21
44
|
if (types.includes("capability")) {
|
|
22
45
|
for (const cap of descriptor.capabilities) {
|
|
23
|
-
const
|
|
24
|
-
const score = scoreText(text, tokens);
|
|
46
|
+
const score = scoreText(capabilityHaystack(cap), tokens);
|
|
25
47
|
if (score > 0) {
|
|
26
|
-
const
|
|
48
|
+
const item = {
|
|
27
49
|
type: "capability",
|
|
28
50
|
id: cap.id,
|
|
29
51
|
label: cap.label,
|
|
30
52
|
score,
|
|
31
53
|
reason: `Matched ${Math.round(score * 100)}% of query tokens`,
|
|
32
54
|
};
|
|
33
|
-
const item = { ...base };
|
|
34
55
|
if (options?.include?.includes("inputSchema"))
|
|
35
56
|
item.inputSchema = cap.inputSchema;
|
|
36
57
|
if (options?.include?.includes("outputSchema"))
|
|
@@ -41,8 +62,7 @@ export function searchCapabilities(query, descriptor, options) {
|
|
|
41
62
|
}
|
|
42
63
|
if (types.includes("extension")) {
|
|
43
64
|
for (const ext of descriptor.extensions) {
|
|
44
|
-
const
|
|
45
|
-
const score = scoreText(text, tokens);
|
|
65
|
+
const score = scoreText(extensionHaystack(ext), tokens);
|
|
46
66
|
if (score > 0) {
|
|
47
67
|
results.push({
|
|
48
68
|
type: "extension",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search.js","sourceRoot":"","sources":["../../src/environment/search.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAA;
|
|
1
|
+
{"version":3,"file":"search.js","sourceRoot":"","sources":["../../src/environment/search.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAA;AAQpE,SAAS,QAAQ,CAAC,KAAa;IAC7B,OAAO,KAAK,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;AACzD,CAAC;AAED,SAAS,SAAS,CAAC,IAAY,EAAE,MAAgB;IAC/C,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,CAAC,CAAA;IACjC,MAAM,GAAG,GAAG,IAAI,CAAC,WAAW,EAAE,CAAA;IAC9B,IAAI,OAAO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,MAAM,EAAE,yBAAyB;iBAClC,CAAC,CAAA;YACJ,CAAC;QACH,CAAC;IACH,CAAC;IAED,IAAI,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC7B,KAAK,MAAM,GAAG,IAAI,UAAU,CAAC,QAAQ,EAAE,CAAC;YACtC,MAAM,IAAI,GAAG,GAAG,GAAG,CAAC,EAAE,IAAI,GAAG,CAAC,KAAK,IAAI,EAAE,IAAI,GAAG,CAAC,OAAO,IAAI,EAAE,EAAE,CAAA;YAChE,MAAM,KAAK,GAAG,SAAS,CAAC,IAAI,EAAE,MAAM,CAAC,CAAA;YACrC,IAAI,KAAK,GAAG,CAAC,EAAE,CAAC;gBACd,OAAO,CAAC,IAAI,CAAC;oBACX,IAAI,EAAE,QAAQ;oBACd,EAAE,EAAE,GAAG,CAAC,EAAE;oBACV,KAAK,EAAE,GAAG,CAAC,KAAK;oBAChB,KAAK;oBACL,MAAM,EAAE,sBAAsB;iBAC/B,CAAC,CAAA;YACJ,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,CAAA;IACzC,MAAM,KAAK,GAAG,OAAO,EAAE,KAAK,IAAI,CAAC,CAAA;IAEjC,OAAO;QACL,MAAM,EAAE,8CAA8C;QACtD,OAAO,EAAE,kBAAkB;QAC3B,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC;KACjC,CAAA;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format-fluent.d.ts","sourceRoot":"","sources":["../../src/formats/format-fluent.ts"],"names":[],"mappings":"AAKA,0EAA0E;AAC1E,eAAO,MAAM,qBAAqB,
|
|
1
|
+
{"version":3,"file":"format-fluent.d.ts","sourceRoot":"","sources":["../../src/formats/format-fluent.ts"],"names":[],"mappings":"AAKA,0EAA0E;AAC1E,eAAO,MAAM,qBAAqB,uDA+BxB,CAAA"}
|
|
@@ -3,10 +3,26 @@ import { ecpEncodeInputSchema, ecpEncodeResultSchema } from "../encoding/schemas
|
|
|
3
3
|
import { encodeFluent } from "../fluent/encode-fluent.js";
|
|
4
4
|
/** Core Fluent format extension (encode only in v1). @category Formats */
|
|
5
5
|
export const formatFluentExtension = defineExtension("@executioncontrolprotocol", "format-fluent")
|
|
6
|
+
.withMetadata({
|
|
7
|
+
summary: "Fluent TypeScript source generation from ECP documents.",
|
|
8
|
+
description: "Renders workflow manifests into Fluent API TypeScript source for authoring panels and round-trip editing. Encode-only in v1.",
|
|
9
|
+
})
|
|
6
10
|
.withCapabilities([
|
|
7
11
|
capabilityFor("@executioncontrolprotocol/format-fluent", "encode")
|
|
8
12
|
.withInput(ecpEncodeInputSchema)
|
|
9
13
|
.withOutput(ecpEncodeResultSchema)
|
|
14
|
+
.withMetadata({
|
|
15
|
+
summary: "Render a workflow manifest as Fluent TypeScript.",
|
|
16
|
+
description: "Produces editable Fluent API source from a workflow manifest. Used by authoring UIs and ecp encode --format fluent.",
|
|
17
|
+
useCases: [
|
|
18
|
+
"Editor code panel shows Fluent source for the active workflow.",
|
|
19
|
+
"Harness converts a generated manifest back into editable TS.",
|
|
20
|
+
],
|
|
21
|
+
samplePrompts: [
|
|
22
|
+
"Show this workflow as Fluent TypeScript.",
|
|
23
|
+
"Generate Fluent source from the current manifest.",
|
|
24
|
+
],
|
|
25
|
+
})
|
|
10
26
|
.withHandler((input) => encodeFluent(input.source, {
|
|
11
27
|
...input.options,
|
|
12
28
|
sourceSchema: input.sourceSchema,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format-fluent.js","sourceRoot":"","sources":["../../src/formats/format-fluent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AACxE,OAAO,EAAE,oBAAoB,EAAE,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AgE;YAChE,8DAA8D;SAC/D;QACD,aAAa,EAAE;YACb,0CAA0C;YAC1C,mDAAmD;SACpD;KACF,CAAC;SACD,WAAW,CAAC,CAAC,KAAK,EAAE,EAAE,CACrB,YAAY,CAAE,KAAwB,CAAC,MAAM,EAAE;QAC7C,GAAI,KAAwB,CAAC,OAAO;QACpC,YAAY,EAAG,KAAwB,CAAC,YAAY;QACpD,aAAa,EAAG,KAAwB,CAAC,aAAa;KACvD,CAAC,CACH;CACJ,CAAC;KACD,KAAK,EAAE,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format-json.d.ts","sourceRoot":"","sources":["../../src/formats/format-json.ts"],"names":[],"mappings":"AAuCA,oDAAoD;AACpD,eAAO,MAAM,mBAAmB,
|
|
1
|
+
{"version":3,"file":"format-json.d.ts","sourceRoot":"","sources":["../../src/formats/format-json.ts"],"names":[],"mappings":"AAuCA,oDAAoD;AACpD,eAAO,MAAM,mBAAmB,uDAyEtB,CAAA"}
|
|
@@ -30,10 +30,26 @@ function validateDecodedDocument(document, targetSchema) {
|
|
|
30
30
|
}
|
|
31
31
|
/** Core JSON format extension. @category Formats */
|
|
32
32
|
export const formatJsonExtension = defineExtension("@executioncontrolprotocol", "format-json")
|
|
33
|
+
.withMetadata({
|
|
34
|
+
summary: "Canonical JSON encode and decode for ECP documents.",
|
|
35
|
+
description: "Passthrough JSON serialization and parsing with optional target validation for workflows, patches, and intent documents.",
|
|
36
|
+
})
|
|
33
37
|
.withCapabilities([
|
|
34
38
|
capabilityFor("@executioncontrolprotocol/format-json", "encode")
|
|
35
39
|
.withInput(ecpEncodeInputSchema)
|
|
36
40
|
.withOutput(ecpEncodeResultSchema)
|
|
41
|
+
.withMetadata({
|
|
42
|
+
summary: "Serialize an ECP document to JSON text.",
|
|
43
|
+
description: "Encodes a source document as formatted JSON. Used when no specialized format is selected or for canonical manifest export.",
|
|
44
|
+
useCases: [
|
|
45
|
+
"CLI writes a compiled workflow manifest to disk.",
|
|
46
|
+
"API returns a JSON snapshot of the current document.",
|
|
47
|
+
],
|
|
48
|
+
samplePrompts: [
|
|
49
|
+
"Export this workflow as JSON.",
|
|
50
|
+
"Encode the manifest to pretty-printed JSON.",
|
|
51
|
+
],
|
|
52
|
+
})
|
|
37
53
|
.withHandler((input) => encodeJson(input.source, {
|
|
38
54
|
...input.options,
|
|
39
55
|
sourceSchema: input.sourceSchema,
|
|
@@ -42,6 +58,18 @@ export const formatJsonExtension = defineExtension("@executioncontrolprotocol",
|
|
|
42
58
|
capabilityFor("@executioncontrolprotocol/format-json", "decode")
|
|
43
59
|
.withInput(ecpDecodeInputSchema)
|
|
44
60
|
.withOutput(ecpDecodeResultSchema)
|
|
61
|
+
.withMetadata({
|
|
62
|
+
summary: "Parse JSON text into an ECP document.",
|
|
63
|
+
description: "Parses JSON input and optionally validates against a target document type. Returns validation diagnostics when the parsed object fails checks.",
|
|
64
|
+
useCases: [
|
|
65
|
+
"Loader imports a workflow.json file into the editor.",
|
|
66
|
+
"Patch step parses JSON model output before applying changes.",
|
|
67
|
+
],
|
|
68
|
+
samplePrompts: [
|
|
69
|
+
"Decode this JSON file into a workflow manifest.",
|
|
70
|
+
"Parse the JSON patch document from the model.",
|
|
71
|
+
],
|
|
72
|
+
})
|
|
45
73
|
.withHandler((input) => {
|
|
46
74
|
const decoded = input;
|
|
47
75
|
const target = decoded.targetSchema;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format-json.js","sourceRoot":"","sources":["../../src/formats/format-json.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AACxE,OAAO,EACL,oBAAoB,EACpB,qBAAqB,EACrB,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,wBAAwB,CAAA;AAC/B,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAA;AAElE,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAA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/B,UAAU,CAAC,qBAAqB,CAAC;SACjC,YAAY,CAAC;QACZ,OAAO,EAAE,uCAAuC;QAChD,WAAW,EACT,gJAAgJ;QAClJ,QAAQ,EAAE;YACR,sDAAsD;YACtD,8DAA8D;SAC/D;QACD,aAAa,EAAE;YACb,iDAAiD;YACjD,+CAA+C;SAChD;KACF,CAAC;SACD,WAAW,CAAC,CAAC,KAAK,EAAE,EAAE;QACrB,MAAM,OAAO,GAAG,KAAuB,CAAA;QACvC,MAAM,MAAM,GAAG,OAAO,CAAC,YAAY,CAAA;QACnC,MAAM,MAAM,GAAG,UAAU,CAAC,OAAO,CAAC,KAAK,EAAE;YACvC,YAAY,EAAE,MAAM;YACpB,aAAa,EAAE,OAAO,CAAC,aAAa;YACpC,GAAG,OAAO,CAAC,OAAO;SACnB,CAAC,CAAA;QACF,IAAI,CAAC,MAAM,CAAC,OAAO,IAAI,MAAM,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;YACnD,OAAO,MAAM,CAAA;QACf,CAAC;QACD,MAAM,UAAU,GAAG,MAAM;YACvB,CAAC,CAAC,uBAAuB,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;YAChD,CAAC,CAAC,qBAAqB,CAAC,IAAI,CAAC,CAAA;QAC/B,MAAM,OAAO,GAAG,UAAU,CAAC,KAAK,CAAA;QAChC,OAAO;YACL,GAAG,MAAM;YACT,UAAU;YACV,OAAO;YACP,WAAW,EAAE;gBACX,GAAG,MAAM,CAAC,WAAW;gBACrB,GAAG,UAAU,CAAC,MAAM;gBACpB,GAAG,UAAU,CAAC,QAAQ;aACvB;SACF,CAAA;IACH,CAAC,CAAC;CACL,CAAC;KACD,KAAK,EAAE,CAAA"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type EcpHarnessReplyAction, type HarnessEvaluateOutput, type WorkflowManifest } from "@executioncontrolprotocol/types";
|
|
2
|
+
/**
|
|
3
|
+
* Extract assistant answer text from a chat harness result when applicable.
|
|
4
|
+
* @category Harness
|
|
5
|
+
*/
|
|
6
|
+
export declare function chatResultAnswer(result: HarnessEvaluateOutput): string | undefined;
|
|
7
|
+
/**
|
|
8
|
+
* Extract authored workflow from a chat harness result.
|
|
9
|
+
* Prefers the sidecar {@link HarnessEvaluateOutput.workflow}; falls back to a
|
|
10
|
+
* legacy workflow-as-artifact shape for older callers.
|
|
11
|
+
* @category Harness
|
|
12
|
+
*/
|
|
13
|
+
export declare function chatResultWorkflow(result: HarnessEvaluateOutput): WorkflowManifest | undefined;
|
|
14
|
+
/**
|
|
15
|
+
* Extract suggested UI action from a chat harness reply artifact.
|
|
16
|
+
* @category Harness
|
|
17
|
+
*/
|
|
18
|
+
export declare function chatResultSuggestedAction(result: HarnessEvaluateOutput): EcpHarnessReplyAction | undefined;
|
|
19
|
+
//# sourceMappingURL=chat-result.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-result.d.ts","sourceRoot":"","sources":["../../../src/harness/authoring/chat-result.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,EAE1B,KAAK,gBAAgB,EACtB,MAAM,iCAAiC,CAAA;AAwBxC;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,qBAAqB,GAAG,MAAM,GAAG,SAAS,CAKlF;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,qBAAqB,GAAG,gBAAgB,GAAG,SAAS,CAQ9F;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,qBAAqB,GAC5B,qBAAqB,GAAG,SAAS,CAYnC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { ECP_HARNESS_REPLY_ACTIONS, ECP_HARNESS_REPLY_SCHEMA, } from "@executioncontrolprotocol/types";
|
|
2
|
+
const WORKFLOW_SCHEMA = "@executioncontrolprotocol.workflow";
|
|
3
|
+
function isRecord(value) {
|
|
4
|
+
return value !== null && typeof value === "object";
|
|
5
|
+
}
|
|
6
|
+
function isWorkflowManifest(value) {
|
|
7
|
+
return (isRecord(value) &&
|
|
8
|
+
value.schema === WORKFLOW_SCHEMA &&
|
|
9
|
+
isRecord(value.workflow));
|
|
10
|
+
}
|
|
11
|
+
function isHarnessReply(value) {
|
|
12
|
+
return (isRecord(value) &&
|
|
13
|
+
value.schema === ECP_HARNESS_REPLY_SCHEMA &&
|
|
14
|
+
typeof value.answer === "string");
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Extract assistant answer text from a chat harness result when applicable.
|
|
18
|
+
* @category Harness
|
|
19
|
+
*/
|
|
20
|
+
export function chatResultAnswer(result) {
|
|
21
|
+
if (isHarnessReply(result.artifact)) {
|
|
22
|
+
return result.artifact.answer;
|
|
23
|
+
}
|
|
24
|
+
return undefined;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Extract authored workflow from a chat harness result.
|
|
28
|
+
* Prefers the sidecar {@link HarnessEvaluateOutput.workflow}; falls back to a
|
|
29
|
+
* legacy workflow-as-artifact shape for older callers.
|
|
30
|
+
* @category Harness
|
|
31
|
+
*/
|
|
32
|
+
export function chatResultWorkflow(result) {
|
|
33
|
+
if (isWorkflowManifest(result.workflow)) {
|
|
34
|
+
return result.workflow;
|
|
35
|
+
}
|
|
36
|
+
if (isWorkflowManifest(result.artifact)) {
|
|
37
|
+
return result.artifact;
|
|
38
|
+
}
|
|
39
|
+
return undefined;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Extract suggested UI action from a chat harness reply artifact.
|
|
43
|
+
* @category Harness
|
|
44
|
+
*/
|
|
45
|
+
export function chatResultSuggestedAction(result) {
|
|
46
|
+
if (!isHarnessReply(result.artifact)) {
|
|
47
|
+
return undefined;
|
|
48
|
+
}
|
|
49
|
+
const action = result.artifact.suggestedAction;
|
|
50
|
+
if (action === ECP_HARNESS_REPLY_ACTIONS.OFFER_RUN ||
|
|
51
|
+
action === ECP_HARNESS_REPLY_ACTIONS.OFFER_PROBE) {
|
|
52
|
+
return action;
|
|
53
|
+
}
|
|
54
|
+
return undefined;
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=chat-result.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-result.js","sourceRoot":"","sources":["../../../src/harness/authoring/chat-result.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,yBAAyB,EACzB,wBAAwB,GAKzB,MAAM,iCAAiC,CAAA;AAExC,MAAM,eAAe,GAAG,oCAAoC,CAAA;AAE5D,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,CAAA;AACpD,CAAC;AAED,SAAS,kBAAkB,CAAC,KAAc;IACxC,OAAO,CACL,QAAQ,CAAC,KAAK,CAAC;QACf,KAAK,CAAC,MAAM,KAAK,eAAe;QAChC,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,CACzB,CAAA;AACH,CAAC;AAED,SAAS,cAAc,CAAC,KAAc;IACpC,OAAO,CACL,QAAQ,CAAC,KAAK,CAAC;QACf,KAAK,CAAC,MAAM,KAAK,wBAAwB;QACzC,OAAO,KAAK,CAAC,MAAM,KAAK,QAAQ,CACjC,CAAA;AACH,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAAC,MAA6B;IAC5D,IAAI,cAAc,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC;QACpC,OAAO,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAA;IAC/B,CAAC;IACD,OAAO,SAAS,CAAA;AAClB,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CAAC,MAA6B;IAC9D,IAAI,kBAAkB,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC;QACxC,OAAO,MAAM,CAAC,QAAQ,CAAA;IACxB,CAAC;IACD,IAAI,kBAAkB,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC;QACxC,OAAO,MAAM,CAAC,QAAQ,CAAA;IACxB,CAAC;IACD,OAAO,SAAS,CAAA;AAClB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,yBAAyB,CACvC,MAA6B;IAE7B,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC;QACrC,OAAO,SAAS,CAAA;IAClB,CAAC;IACD,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,eAAe,CAAA;IAC9C,IACE,MAAM,KAAK,yBAAyB,CAAC,SAAS;QAC9C,MAAM,KAAK,yBAAyB,CAAC,WAAW,EAChD,CAAC;QACD,OAAO,MAAM,CAAA;IACf,CAAC;IACD,OAAO,SAAS,CAAA;AAClB,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { EcpIntent, EcpIntentValue } from "@executioncontrolprotocol/types";
|
|
2
2
|
/** Canonical intent values accepted by {@link ECP_INTENT_SCHEMA}. @category Harness */
|
|
3
|
-
export declare const CLASSIFIED_INTENT_VALUES: readonly ["faq", "workflow-create", "workflow-patch", "general"];
|
|
3
|
+
export declare const CLASSIFIED_INTENT_VALUES: readonly ["faq", "workflow-create", "workflow-patch", "workflow-probe", "workflow-clarify", "general"];
|
|
4
4
|
/**
|
|
5
5
|
* High-confidence intent from user message alone (nano harness correction layer).
|
|
6
6
|
* @category Harness
|
|
@@ -39,8 +39,8 @@ export declare function correctClassifiedIntent(message: string, intent: EcpInte
|
|
|
39
39
|
*/
|
|
40
40
|
export declare function formatClassifiedIntentBlock(intent: EcpIntent): string[];
|
|
41
41
|
/**
|
|
42
|
-
*
|
|
42
|
+
* Short routing hint lines for contextualized shots.
|
|
43
43
|
* @category Harness
|
|
44
44
|
*/
|
|
45
|
-
export declare function formatIntentRoutingHintLines(
|
|
45
|
+
export declare function formatIntentRoutingHintLines(intent: EcpIntentValue): string[];
|
|
46
46
|
//# sourceMappingURL=classified-intent.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"classified-intent.d.ts","sourceRoot":"","sources":["../../../src/harness/authoring/classified-intent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAA;
|
|
1
|
+
{"version":3,"file":"classified-intent.d.ts","sourceRoot":"","sources":["../../../src/harness/authoring/classified-intent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAA;AAKhF,uFAAuF;AACvF,eAAO,MAAM,wBAAwB,wGAOS,CAAA;AAI9C;;;GAGG;AACH,wBAAgB,+BAA+B,CAAC,OAAO,EAAE,MAAM,GAAG,cAAc,GAAG,SAAS,CA+E3F;AAED,4EAA4E;AAC5E,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,cAAc,CAE9E;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,cAAc,EACtB,UAAU,CAAC,EAAE,MAAM,GAClB,MAAM,CAYR;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,cAAc,GAAG,MAAM,CAwCzF;AAED;;;GAGG;AACH,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAMnE;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,GAAG,SAAS,CAMpF;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,GAAG,SAAS,CAkCrF;AAED;;;GAGG;AACH,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,SAAS,GAAG,MAAM,EAAE,CASvE;AAED;;;GAGG;AACH,wBAAgB,4BAA4B,CAAC,MAAM,EAAE,cAAc,GAAG,MAAM,EAAE,CAoB7E"}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
import { isClearAllStepsRequest } from "./patch-clear-intent.js";
|
|
1
2
|
const SUMMARY_MAX_LENGTH = 120;
|
|
2
3
|
/** Canonical intent values accepted by {@link ECP_INTENT_SCHEMA}. @category Harness */
|
|
3
4
|
export const CLASSIFIED_INTENT_VALUES = [
|
|
4
5
|
"faq",
|
|
5
6
|
"workflow-create",
|
|
6
7
|
"workflow-patch",
|
|
8
|
+
"workflow-probe",
|
|
9
|
+
"workflow-clarify",
|
|
7
10
|
"general",
|
|
8
11
|
];
|
|
9
12
|
const CLASSIFIED_INTENT_VALUE_SET = new Set(CLASSIFIED_INTENT_VALUES);
|
|
@@ -46,12 +49,35 @@ export function inferIntentFromMessageHeuristic(message) {
|
|
|
46
49
|
if (/who are you|what are you/i.test(msg)) {
|
|
47
50
|
return "general";
|
|
48
51
|
}
|
|
52
|
+
// Probe: discover/inspect structure before finishing the workflow.
|
|
53
|
+
if (/\b(inspect|discover|probe)\b/i.test(msg) &&
|
|
54
|
+
/\b(structure|layers?|manifest|fields?|assets?|what(?:'s| is) in)\b/i.test(msg)) {
|
|
55
|
+
return "workflow-probe";
|
|
56
|
+
}
|
|
57
|
+
if (/\b(then|after)\b/i.test(msg) &&
|
|
58
|
+
/\b(choose|select|pick)\b/i.test(msg) &&
|
|
59
|
+
/\b(layer|field|option|variant)\b/i.test(msg)) {
|
|
60
|
+
return "workflow-probe";
|
|
61
|
+
}
|
|
62
|
+
if (/\bdiscover structure first\b/i.test(msg) ||
|
|
63
|
+
/\binspect what(?:'s| is) in (?:this|the)\b/i.test(msg)) {
|
|
64
|
+
return "workflow-probe";
|
|
65
|
+
}
|
|
66
|
+
// Clarify: selecting among previously listed options (labels/ids).
|
|
67
|
+
if (/\b(use|pick|choose|select)\b/i.test(msg) &&
|
|
68
|
+
/\b(layer|headline|logo|option|variant|field)\b/i.test(msg) &&
|
|
69
|
+
!/\b(create|build)\b.*\bworkflow\b/i.test(msg)) {
|
|
70
|
+
return "workflow-clarify";
|
|
71
|
+
}
|
|
49
72
|
if (/\bfailed\b/i.test(msg) && /\b(echo|workflow|step)\b/i.test(msg)) {
|
|
50
73
|
return "workflow-patch";
|
|
51
74
|
}
|
|
52
75
|
if (/\b(change|update|set|fix)\b/i.test(msg) && /\b(step|label|echo)\b/i.test(msg)) {
|
|
53
76
|
return "workflow-patch";
|
|
54
77
|
}
|
|
78
|
+
if (isClearAllStepsRequest(msg)) {
|
|
79
|
+
return "workflow-patch";
|
|
80
|
+
}
|
|
55
81
|
if (/\b(create|build|need)\b/i.test(msg) && /\bworkflow\b/i.test(msg)) {
|
|
56
82
|
return "workflow-create";
|
|
57
83
|
}
|
|
@@ -96,9 +122,21 @@ export function deriveIntentTopicFallback(message, intent) {
|
|
|
96
122
|
return "ecp";
|
|
97
123
|
return "ecp";
|
|
98
124
|
}
|
|
125
|
+
if (intent === "workflow-probe") {
|
|
126
|
+
if (/\blayer/i.test(msg))
|
|
127
|
+
return "photoshop-layers";
|
|
128
|
+
if (/\b(field|schema)\b/i.test(msg))
|
|
129
|
+
return "schema-fields";
|
|
130
|
+
return "workflow-probe";
|
|
131
|
+
}
|
|
132
|
+
if (intent === "workflow-clarify") {
|
|
133
|
+
if (/\blayer/i.test(msg))
|
|
134
|
+
return "layer-selection";
|
|
135
|
+
return "option-selection";
|
|
136
|
+
}
|
|
99
137
|
if (intent === "workflow-patch") {
|
|
100
|
-
if (/\
|
|
101
|
-
return "
|
|
138
|
+
if (/\b(poem|generate)\b/i.test(msg))
|
|
139
|
+
return "generate-failure";
|
|
102
140
|
if (/\bfail/i.test(msg))
|
|
103
141
|
return "workflow-failure";
|
|
104
142
|
if (/\b(step|label|input)\b/i.test(msg))
|
|
@@ -106,8 +144,8 @@ export function deriveIntentTopicFallback(message, intent) {
|
|
|
106
144
|
return "workflow-patch";
|
|
107
145
|
}
|
|
108
146
|
if (intent === "workflow-create") {
|
|
109
|
-
if (/\
|
|
110
|
-
return "
|
|
147
|
+
if (/\b(generate|chrome\s*ai|poem|haiku)\b/i.test(msg))
|
|
148
|
+
return "generate-workflow";
|
|
111
149
|
return "workflow-create";
|
|
112
150
|
}
|
|
113
151
|
if (/\b(joke|weather|recipe|resume|cover letter)\b/i.test(msg)) {
|
|
@@ -173,6 +211,11 @@ export function correctClassifiedIntent(message, intent) {
|
|
|
173
211
|
else if (value === "faq" && /what(?:'s| is) the weather/i.test(message)) {
|
|
174
212
|
value = "general";
|
|
175
213
|
}
|
|
214
|
+
else if ((value === "workflow-create" || value === "workflow-patch") &&
|
|
215
|
+
/\b(inspect|discover|probe)\b/i.test(message) &&
|
|
216
|
+
/\b(structure|layers?|manifest)\b/i.test(message)) {
|
|
217
|
+
value = "workflow-probe";
|
|
218
|
+
}
|
|
176
219
|
const topic = canonicalizeIntentTopic(message, value, intent.topic);
|
|
177
220
|
return enrichClassifiedIntent({ ...intent, intent: value, topic }, message);
|
|
178
221
|
}
|
|
@@ -186,44 +229,33 @@ export function formatClassifiedIntentBlock(intent) {
|
|
|
186
229
|
lines.push(`Topic: ${intent.topic}`);
|
|
187
230
|
}
|
|
188
231
|
if (intent.summary) {
|
|
189
|
-
lines.push(`
|
|
232
|
+
lines.push(`Summary: ${intent.summary}`);
|
|
190
233
|
}
|
|
191
234
|
return lines;
|
|
192
235
|
}
|
|
193
236
|
/**
|
|
194
|
-
*
|
|
237
|
+
* Short routing hint lines for contextualized shots.
|
|
195
238
|
* @category Harness
|
|
196
239
|
*/
|
|
197
|
-
export function formatIntentRoutingHintLines(
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
240
|
+
export function formatIntentRoutingHintLines(intent) {
|
|
241
|
+
switch (intent) {
|
|
242
|
+
case "workflow-create":
|
|
243
|
+
return ["Route: author a new workflow from the user request."];
|
|
244
|
+
case "workflow-patch":
|
|
245
|
+
return ["Route: patch the existing workflow for the user request."];
|
|
246
|
+
case "workflow-probe":
|
|
247
|
+
return [
|
|
248
|
+
"Route: author a discovery prefix, then offer a live probe before finishing the workflow.",
|
|
249
|
+
];
|
|
250
|
+
case "workflow-clarify":
|
|
251
|
+
return [
|
|
252
|
+
"Route: interpret the user's selection among probe options, then complete the workflow.",
|
|
253
|
+
];
|
|
254
|
+
case "faq":
|
|
255
|
+
return ["Route: answer an ECP FAQ without changing the workflow."];
|
|
256
|
+
case "general":
|
|
257
|
+
default:
|
|
258
|
+
return ["Route: general assistant reply."];
|
|
201
259
|
}
|
|
202
|
-
if (/^what is ecp\b/i.test(message.trim())) {
|
|
203
|
-
lines.push("Routing hint: definitional questions about ECP → INTENT faq.");
|
|
204
|
-
}
|
|
205
|
-
if (/^(hello|hi|bonjour|hola)\b/i.test(message.trim())) {
|
|
206
|
-
lines.push("Routing hint: greetings → INTENT general (not workflow-create).");
|
|
207
|
-
}
|
|
208
|
-
if (/tell me a joke/i.test(message)) {
|
|
209
|
-
lines.push("Routing hint: off-topic chat → INTENT general.");
|
|
210
|
-
}
|
|
211
|
-
if (/what extensions are available/i.test(message)) {
|
|
212
|
-
lines.push("Routing hint: capability inventory questions → INTENT general.");
|
|
213
|
-
}
|
|
214
|
-
if (/what (?:is the )?run status/i.test(message)) {
|
|
215
|
-
lines.push("Routing hint: run status questions → INTENT general.");
|
|
216
|
-
}
|
|
217
|
-
if (/^what can you do\??$/i.test(message.trim())) {
|
|
218
|
-
lines.push("Routing hint: assistant identity → INTENT general.");
|
|
219
|
-
}
|
|
220
|
-
if (/\b(update|change|set)\b/i.test(message) &&
|
|
221
|
-
/\b(step|echo|summarize|validate|notify|translate)\b/i.test(message)) {
|
|
222
|
-
lines.push("Routing hint: changing an existing step → INTENT workflow-patch.");
|
|
223
|
-
}
|
|
224
|
-
if (/\bfailed\b/i.test(message) && /\b(step|workflow|echo)\b/i.test(message)) {
|
|
225
|
-
lines.push("Routing hint: workflow failure symptom → INTENT workflow-patch.");
|
|
226
|
-
}
|
|
227
|
-
return lines;
|
|
228
260
|
}
|
|
229
261
|
//# sourceMappingURL=classified-intent.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"classified-intent.js","sourceRoot":"","sources":["../../../src/harness/authoring/classified-intent.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"classified-intent.js","sourceRoot":"","sources":["../../../src/harness/authoring/classified-intent.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAA;AAEhE,MAAM,kBAAkB,GAAG,GAAG,CAAA;AAE9B,uFAAuF;AACvF,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACtC,KAAK;IACL,iBAAiB;IACjB,gBAAgB;IAChB,gBAAgB;IAChB,kBAAkB;IAClB,SAAS;CACmC,CAAA;AAE9C,MAAM,2BAA2B,GAAG,IAAI,GAAG,CAAS,wBAAwB,CAAC,CAAA;AAE7E;;;GAGG;AACH,MAAM,UAAU,+BAA+B,CAAC,OAAe;IAC7D,MAAM,GAAG,GAAG,OAAO,CAAC,IAAI,EAAE,CAAA;IAC1B,IAAI,mBAAmB,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;QAClC,OAAO,KAAK,CAAA;IACd,CAAC;IACD,IAAI,uBAAuB,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;QAC/D,OAAO,KAAK,CAAA;IACd,CAAC;IACD,IAAI,oBAAoB,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;QACnC,OAAO,KAAK,CAAA;IACd,CAAC;IACD,IAAI,oCAAoC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;QACnD,OAAO,SAAS,CAAA;IAClB,CAAC;IACD,IAAI,iBAAiB,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;QAChC,OAAO,SAAS,CAAA;IAClB,CAAC;IACD,IAAI,6CAA6C,CAAC,IAAI,CAAC,GAAG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ntentValue, HarnessPromptPhase, HarnessRunContext, WorkflowManifest } from "@executioncontrolprotocol/types";
|
|
2
|
+
import type { EcpIntentValue, HarnessPromptPhase, HarnessRunContext, ProbeContext, WorkflowManifest } from "@executioncontrolprotocol/types";
|
|
3
3
|
/** Character budget caps for user prompt context blocks. @category Harness */
|
|
4
4
|
export declare const CONTEXT_PROMPT_BUDGET: {
|
|
5
5
|
readonly unfiltered: 2000;
|
|
@@ -17,6 +17,8 @@ export interface ContextBundleOptions {
|
|
|
17
17
|
manifest?: WorkflowManifest;
|
|
18
18
|
/** Run context for assistant-style bundles. */
|
|
19
19
|
runContext?: HarnessRunContext;
|
|
20
|
+
/** Live probe options for clarify / complete turns. */
|
|
21
|
+
probeContext?: ProbeContext;
|
|
20
22
|
/** Rolling conversation summary from the caller. */
|
|
21
23
|
conversationSummary?: string;
|
|
22
24
|
/** Include environment descriptor block. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context-policy.d.ts","sourceRoot":"","sources":["../../../src/harness/authoring/context-policy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,0BAA0B,CAAA;AACnD,OAAO,KAAK,EACV,cAAc,EACd,kBAAkB,EAClB,iBAAiB,EACjB,gBAAgB,EACjB,MAAM,iCAAiC,CAAA;
|
|
1
|
+
{"version":3,"file":"context-policy.d.ts","sourceRoot":"","sources":["../../../src/harness/authoring/context-policy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,0BAA0B,CAAA;AACnD,OAAO,KAAK,EACV,cAAc,EACd,kBAAkB,EAClB,iBAAiB,EACjB,YAAY,EACZ,gBAAgB,EACjB,MAAM,iCAAiC,CAAA;AAexC,8EAA8E;AAC9E,eAAO,MAAM,qBAAqB;;;CAGxB,CAAA;AAEV,gEAAgE;AAChE,MAAM,WAAW,oBAAoB;IACnC,6BAA6B;IAC7B,KAAK,EAAE,kBAAkB,CAAA;IACzB,0DAA0D;IAC1D,OAAO,EAAE,MAAM,CAAA;IACf,6DAA6D;IAC7D,MAAM,CAAC,EAAE,cAAc,CAAA;IACvB,2EAA2E;IAC3E,QAAQ,CAAC,EAAE,gBAAgB,CAAA;IAC3B,+CAA+C;IAC/C,UAAU,CAAC,EAAE,iBAAiB,CAAA;IAC9B,uDAAuD;IACvD,YAAY,CAAC,EAAE,YAAY,CAAA;IAC3B,oDAAoD;IACpD,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAC5B,4CAA4C;IAC5C,4BAA4B,CAAC,EAAE,OAAO,CAAA;IACtC,6CAA6C;IAC7C,wBAAwB,CAAC,EAAE,OAAO,CAAA;IAClC,wCAAwC;IACxC,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,0DAA0D;IAC1D,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,sDAAsD;IACtD,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,6EAA6E;IAC7E,sBAAsB,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;CACrC;AAED,0EAA0E;AAC1E,MAAM,WAAW,aAAa;IAC5B,0EAA0E;IAC1E,KAAK,EAAE,MAAM,EAAE,CAAA;CAChB;AAkHD;;;GAGG;AACH,wBAAsB,kBAAkB,CACtC,GAAG,EAAE,GAAG,EACR,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC,aAAa,CAAC,CAwExB"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { encodeForPrompt } from "./encode-prompt-text.js";
|
|
2
2
|
import { isEnvironmentQuestion } from "./environment-question.js";
|
|
3
|
+
import { loadEnvironmentDescribeForPrompt } from "./describe-for-prompt.js";
|
|
3
4
|
import { formatEnvironmentSummaryLines, summarizeEnvironmentDescriptor, toAuthoringEnvironmentDescriptor, } from "./summarize-environment.js";
|
|
5
|
+
import { summarizeProbeContext } from "./summarize-probe-context.js";
|
|
4
6
|
import { formatRunContextSummaryLines } from "./summarize-run-context.js";
|
|
5
7
|
import { formatWorkflowSummaryLines } from "./summarize-workflow.js";
|
|
6
8
|
/** Character budget caps for user prompt context blocks. @category Harness */
|
|
@@ -29,10 +31,10 @@ function envFormatForIntent(intent, outputIsEql, isPatch) {
|
|
|
29
31
|
if (!outputIsEql) {
|
|
30
32
|
return "plain";
|
|
31
33
|
}
|
|
32
|
-
if (intent === "workflow-create") {
|
|
34
|
+
if (intent === "workflow-create" || intent === "workflow-probe") {
|
|
33
35
|
return "eql-create";
|
|
34
36
|
}
|
|
35
|
-
if (intent === "workflow-patch" || isPatch) {
|
|
37
|
+
if (intent === "workflow-patch" || intent === "workflow-clarify" || isPatch) {
|
|
36
38
|
return "eql-patch";
|
|
37
39
|
}
|
|
38
40
|
return "plain";
|
|
@@ -61,6 +63,8 @@ function shouldIncludeEnvironment(options, envQuestion) {
|
|
|
61
63
|
}
|
|
62
64
|
return (options.intent === "workflow-create" ||
|
|
63
65
|
options.intent === "workflow-patch" ||
|
|
66
|
+
options.intent === "workflow-probe" ||
|
|
67
|
+
options.intent === "workflow-clarify" ||
|
|
64
68
|
options.intent === "faq" ||
|
|
65
69
|
options.intent === "general" ||
|
|
66
70
|
envQuestion);
|
|
@@ -70,6 +74,7 @@ function shouldIncludeRunContext(options) {
|
|
|
70
74
|
return false;
|
|
71
75
|
}
|
|
72
76
|
return (options.intent === "workflow-patch" ||
|
|
77
|
+
options.intent === "workflow-clarify" ||
|
|
73
78
|
options.intent === "faq" ||
|
|
74
79
|
options.intent === "general");
|
|
75
80
|
}
|
|
@@ -77,7 +82,20 @@ function shouldIncludeWorkflowSummary(options) {
|
|
|
77
82
|
if (options.phase === "unfiltered" || !options.manifest) {
|
|
78
83
|
return false;
|
|
79
84
|
}
|
|
80
|
-
return options.intent === "workflow-patch" ||
|
|
85
|
+
return (options.intent === "workflow-patch" ||
|
|
86
|
+
options.intent === "workflow-probe" ||
|
|
87
|
+
options.intent === "workflow-clarify" ||
|
|
88
|
+
options.intent === "faq" ||
|
|
89
|
+
options.intent === "general");
|
|
90
|
+
}
|
|
91
|
+
function shouldIncludeProbeContext(options) {
|
|
92
|
+
if (options.phase === "unfiltered" || !options.probeContext) {
|
|
93
|
+
return false;
|
|
94
|
+
}
|
|
95
|
+
return (options.intent === "workflow-clarify" ||
|
|
96
|
+
options.intent === "workflow-patch" ||
|
|
97
|
+
options.intent === "faq" ||
|
|
98
|
+
options.intent === "general");
|
|
81
99
|
}
|
|
82
100
|
/**
|
|
83
101
|
* Build context lines for a harness prompt phase and classified intent.
|
|
@@ -94,8 +112,9 @@ export async function buildContextBundle(ecp, options) {
|
|
|
94
112
|
let environmentSummary;
|
|
95
113
|
let environmentDescriptor;
|
|
96
114
|
if (shouldIncludeEnvironment(options, envQuestion)) {
|
|
97
|
-
|
|
98
|
-
|
|
115
|
+
const { inventory, detailLines } = await loadEnvironmentDescribeForPrompt(ecp, options.message);
|
|
116
|
+
environmentDescriptor = inventory;
|
|
117
|
+
environmentSummary = summarizeEnvironmentDescriptor(inventory);
|
|
99
118
|
const envLines = formatEnvironmentSummaryLines(environmentSummary, {
|
|
100
119
|
format: envFormatForIntent(options.intent, outputIsEql, options.isPatch ?? false),
|
|
101
120
|
existingCapabilityUses: options.existingCapabilityUses,
|
|
@@ -103,6 +122,9 @@ export async function buildContextBundle(ecp, options) {
|
|
|
103
122
|
if (envLines.length > 0) {
|
|
104
123
|
lines.push("Environment capabilities:", ...envLines, "");
|
|
105
124
|
}
|
|
125
|
+
if (detailLines.length > 0) {
|
|
126
|
+
lines.push("Capability / extension detail:", ...detailLines);
|
|
127
|
+
}
|
|
106
128
|
if (shouldIncludeEncodedDescriptor(options, envQuestion) &&
|
|
107
129
|
environmentDescriptor !== undefined) {
|
|
108
130
|
const descriptorFormat = options.descriptorFormat ?? "@executioncontrolprotocol/format-eql";
|
|
@@ -127,6 +149,12 @@ export async function buildContextBundle(ecp, options) {
|
|
|
127
149
|
lines.push("Run context (summary):", ...runLines, "");
|
|
128
150
|
}
|
|
129
151
|
}
|
|
152
|
+
if (shouldIncludeProbeContext(options) && options.probeContext) {
|
|
153
|
+
const probeLines = summarizeProbeContext(options.probeContext);
|
|
154
|
+
if (probeLines.length > 0) {
|
|
155
|
+
lines.push("Probe context:", ...probeLines, "");
|
|
156
|
+
}
|
|
157
|
+
}
|
|
130
158
|
return { lines: trimLinesToBudget(lines, budget) };
|
|
131
159
|
}
|
|
132
160
|
//# sourceMappingURL=context-policy.js.map
|