@promptdriven/runtime-client 1.0.0 → 1.1.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/package.json +1 -1
- package/src/runtime/agent-chat.mjs +55 -8
- package/src/runtime/index.mjs +32 -1
- package/src/runtime/live-local-bridge.mjs +178 -0
- package/src/runtime/live-local.mjs +181 -0
- package/src/runtime/run-program.mjs +797 -0
- package/src/runtime/runtime-bindings.mjs +22 -12
- package/src/runtime/runtime-check-plan.mjs +1 -1
- package/src/runtime/runtime-client.mjs +2009 -218
- package/src/runtime/runtime-outcome.mjs +63 -2
- package/src/runtime/runtime-output.mjs +46 -8
- package/src/runtime/runtime-preflight.mjs +793 -79
- package/src/runtime/runtime-slots.mjs +75 -4
- package/src/runtime/scenario-json.mjs +167 -1
- package/src/runtime/secret-redaction.mjs +3 -2
- package/src/runtime/try-doors.mjs +425 -59
- package/src/runtime/try-http.mjs +40 -14
- package/src/runtime/try-update-policy.mjs +43 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Generated from prompts/cli/runtime-bindings.prompt.md (sha256:
|
|
1
|
+
// Generated from prompts/cli/runtime-bindings.prompt.md (sha256: d852225e7cabfb564f74e7cdd977f73a1fbf92e50346a72c31bcf566cc1a1e98).
|
|
2
2
|
import {loadRuntimeWorkspace,allowsRuntimePath} from './runtime-workspace.mjs';
|
|
3
3
|
import { lstatSync } from 'node:fs';
|
|
4
4
|
import { join } from 'node:path';
|
|
@@ -32,28 +32,31 @@ export function bindingCoverage({ root, found, selected, includeRuntime = false,
|
|
|
32
32
|
if (!keys(inventory, ['schema_version', 'modules']) || inventory.schema_version !== 'pdd.bindings.v1' || !Array.isArray(inventory.modules)) fail('inventory', 'expected schema_version pdd.bindings.v1 and modules array only');
|
|
33
33
|
if (inventory.modules.length > 1000) fail('inventory', 'exceeds 1000 module declarations');
|
|
34
34
|
const stories = new Set(found.stories.map(s => s.path)), chosen = new Set(selected.map(t => t.storyPath)), seen = new Set(), modules = [];
|
|
35
|
-
const reached = new Set(),
|
|
35
|
+
const reached = new Set(), context = new Set(), visited = new Set();
|
|
36
|
+
const queue = selected.flatMap(t => (Array.isArray(t.doc?.steps) ? t.doc.steps : []).map(s => ({path:s?.entry_path, executable:true})));
|
|
36
37
|
while (queue.length) {
|
|
37
|
-
const path = queue.shift()
|
|
38
|
-
|
|
38
|
+
const {path,executable} = queue.shift(), identity = `${executable ? 'call' : 'context'}:${path}`;
|
|
39
|
+
if (typeof path !== 'string' || visited.has(identity)) continue;
|
|
40
|
+
visited.add(identity);
|
|
41
|
+
(executable ? reached : context).add(path);
|
|
39
42
|
const prompt = readPrompt(root, found.visible, path, workspace);
|
|
40
|
-
for (const call of Array.isArray(prompt?.interface?.calls) ? prompt.interface.calls : []) if (typeof call?.target === 'string') queue.push(call.target);
|
|
41
|
-
|
|
42
|
-
for (const target of promptMarkdownTargets(prompt.text, path, found.visible)) queue.push(target);
|
|
43
|
-
}
|
|
43
|
+
for (const call of Array.isArray(prompt?.interface?.calls) ? prompt.interface.calls : []) if (typeof call?.target === 'string') queue.push({path:call.target,executable});
|
|
44
|
+
for (const target of promptMarkdownTargets(prompt.text, path, found.visible)) queue.push({path:target,executable:false});
|
|
44
45
|
}
|
|
45
46
|
for (const item of inventory.modules) {
|
|
46
47
|
const path = item?.module ?? 'module';
|
|
47
48
|
if (!object(item)) fail(path, 'expected module declaration');
|
|
48
49
|
const bound = Object.hasOwn(item, 'prompt');
|
|
49
|
-
|
|
50
|
+
const hasStories = Object.hasOwn(item, 'stories');
|
|
51
|
+
if (!keys(item, bound ? (hasStories ? ['module', 'stories', 'prompt'] : ['module', 'prompt']) : ['module', 'stories', 'reason', 'port_attempt'])) fail(path, 'declare prompt or both reason and port_attempt, with no extra fields');
|
|
50
52
|
if(!allowsRuntimePath(workspace,item.module))continue;
|
|
51
53
|
regular(item.module); if (seen.has(item.module)) fail(path, 'duplicate module'); seen.add(item.module);
|
|
52
|
-
|
|
53
|
-
|
|
54
|
+
const itemStories = bound && !hasStories ? [] : item.stories;
|
|
55
|
+
if (!Array.isArray(itemStories) || (!bound && !itemStories.length) || new Set(itemStories).size !== itemStories.length) fail(path, bound ? 'stories must be an array of unique Story paths' : 'stories must be nonempty and unique');
|
|
56
|
+
for (const story of itemStories) { regular(story); if (!stories.has(story)) fail(path, `unknown Story ${story}`); }
|
|
54
57
|
if (bound) { regular(item.prompt); if (!item.prompt.endsWith('.prompt.md')) fail(path, `${item.prompt} must be a *.prompt.md file`); }
|
|
55
58
|
else for (const key of ['reason', 'port_attempt']) if (typeof item[key] !== 'string' || !item[key].trim()) fail(path, `${key} must be nonblank`);
|
|
56
|
-
if (!
|
|
59
|
+
if (!itemStories.some(story => chosen.has(story))) continue;
|
|
57
60
|
if (bound) {
|
|
58
61
|
const prompt = readPrompt(root, found.visible, item.prompt, workspace);
|
|
59
62
|
const nativeProblem = (prompt.frontmatter || prompt?.interface?.kind === 'native-only') ? promptRefusal(prompt, 'interface') : null;
|
|
@@ -63,6 +66,13 @@ export function bindingCoverage({ root, found, selected, includeRuntime = false,
|
|
|
63
66
|
continue;
|
|
64
67
|
}
|
|
65
68
|
const lazyMissing = allowMissingInterfaces && prompt.error === 'interface-missing';
|
|
69
|
+
if ((lazyMissing && reached.has(item.prompt)) || (!reached.has(item.prompt) && context.has(item.prompt) && prompt.error === 'interface-missing')) {
|
|
70
|
+
const pending = reached.has(item.prompt);
|
|
71
|
+
modules.push({path:item.module,state:'unbound',prompt:item.prompt,
|
|
72
|
+
reason:pending ? 'Runtime interface pending' : 'Context-only module contract',
|
|
73
|
+
port_attempt:pending ? 'lazy interface synthesis pending' : 'no executable Runtime call'});
|
|
74
|
+
continue;
|
|
75
|
+
}
|
|
66
76
|
if (!reached.has(item.prompt) || (!lazyMissing && (prompt.error || !Array.isArray(prompt?.interface?.entries) || !prompt.interface.entries.length || prompt.interface.entries.some(entry => !entry || typeof entry.operation !== 'string' || !entry.operation.trim() || !object(entry.input_schema) || !object(entry.result_schema))))) fail(path, `${item.prompt} must be reached and have an executable Runtime interface`);
|
|
67
77
|
}
|
|
68
78
|
modules.push({ path: item.module, state: bound ? 'bound' : 'unbound', ...(bound ? {} : { reason: item.reason, port_attempt: item.port_attempt }) });
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Generated from prompts/cli/runtime-check-plan.prompt.md (sha256:
|
|
1
|
+
// Generated from prompts/cli/runtime-check-plan.prompt.md (sha256: 764a2cdf6815a01f951ddd339d70b7aa44f7caac0ab93cb021d9164ab2b5d2c2).
|
|
2
2
|
import { spawnSync } from 'node:child_process';
|
|
3
3
|
import { isAbsolute, posix } from 'node:path';
|
|
4
4
|
import { captureSource, readPrompt, sourceFilePort, promptMarkdownTargets } from './runtime-preflight.mjs';
|