@akagilnc/pi-workflow-roles 0.1.3771 → 0.1.3783
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/acp-host/production-host.js +330 -181
- package/dist/headless-host/description.js +77 -0
- package/dist/headless-host/mcp-relay.mjs +119 -0
- package/dist/headless-host/production-host.js +26590 -0
- package/dist/host-descriptions.js +44 -3
- package/dist/public-cli/load-production-external-host.js +19 -0
- package/dist/public-cli/load-production-headless-host.js +36 -0
- package/dist/public-cli/main.js +242 -162
- package/dist/public-role-summons.js +40 -5
- package/package.json +1 -1
- package/scripts/build-package.mjs +28 -0
- package/src/acp-host/role-envelope.ts +141 -84
- package/src/acp-host/role-turn-host.ts +12 -0
- package/src/headless-host/description.ts +123 -0
- package/src/headless-host/production-host.ts +75 -0
- package/src/headless-host/role-turn-host.ts +424 -0
- package/src/host-descriptions.ts +53 -6
- package/src/public-cli/cli.ts +2 -2
- package/src/public-cli/load-production-external-host.ts +29 -0
- package/src/public-cli/load-production-headless-host.ts +48 -0
- package/src/public-cli/main.ts +5 -0
- package/src/public-role-summons.ts +62 -9
|
@@ -45,15 +45,56 @@ export const HOST_DESCRIPTIONS = Object.freeze({
|
|
|
45
45
|
}),
|
|
46
46
|
}),
|
|
47
47
|
});
|
|
48
|
+
/**
|
|
49
|
+
* Headless CLI family (#645). Claude is the first row; codex (#646) adds another.
|
|
50
|
+
* fixedArgs: print mode, isolation without `--bare` (OAuth stays), full permissions.
|
|
51
|
+
* `--setting-sources` empty = load no user/project/local CLAUDE.md/hooks/skills
|
|
52
|
+
* (role envelope is delivered via `--system-prompt` wholesale replace).
|
|
53
|
+
* `--strict-mcp-config` with no `--mcp-config` drops operator MCP + claude.ai connectors.
|
|
54
|
+
*/
|
|
55
|
+
export const HEADLESS_HOST_DESCRIPTIONS = Object.freeze({
|
|
56
|
+
"claude": Object.freeze({
|
|
57
|
+
binaryFromHome: Object.freeze([".local", "bin", "claude"]),
|
|
58
|
+
sessionBindingFile: "claude-headless-session.json",
|
|
59
|
+
fixedArgs: Object.freeze([
|
|
60
|
+
// One result envelope (not stream-json): typed receipt only; no event-stream copy.
|
|
61
|
+
"--output-format", "json",
|
|
62
|
+
"--permission-mode", "bypassPermissions",
|
|
63
|
+
// Empty sources: no user/project/local operator surface (envelope owns materials).
|
|
64
|
+
"--setting-sources", "",
|
|
65
|
+
// With adapter-supplied --mcp-config only (AK relay); drops operator + claude.ai MCP.
|
|
66
|
+
"--strict-mcp-config",
|
|
67
|
+
]),
|
|
68
|
+
promptFlag: "-p",
|
|
69
|
+
modelFlag: "--model",
|
|
70
|
+
effortFlag: "--effort",
|
|
71
|
+
// File path keeps large role envelopes off ARG_MAX.
|
|
72
|
+
systemPromptFlag: "--system-prompt-file",
|
|
73
|
+
jsonSchemaFlag: "--json-schema",
|
|
74
|
+
mcpConfigFlag: "--mcp-config",
|
|
75
|
+
sessionIdFlag: "--session-id",
|
|
76
|
+
resumeFlag: "--resume",
|
|
77
|
+
}),
|
|
78
|
+
});
|
|
48
79
|
export function lookupHostDescription(host) {
|
|
49
80
|
return Object.hasOwn(HOST_DESCRIPTIONS, host) ? HOST_DESCRIPTIONS[host] : undefined;
|
|
50
81
|
}
|
|
82
|
+
export function lookupHeadlessHostDescription(host) {
|
|
83
|
+
return Object.hasOwn(HEADLESS_HOST_DESCRIPTIONS, host) ? HEADLESS_HOST_DESCRIPTIONS[host] : undefined;
|
|
84
|
+
}
|
|
85
|
+
export function lookupHostFamily(host) {
|
|
86
|
+
if (lookupHostDescription(host) !== undefined)
|
|
87
|
+
return "acp";
|
|
88
|
+
if (lookupHeadlessHostDescription(host) !== undefined)
|
|
89
|
+
return "headless";
|
|
90
|
+
return undefined;
|
|
91
|
+
}
|
|
51
92
|
export function packagedExternalHostNames() {
|
|
52
|
-
return Object.keys(HOST_DESCRIPTIONS);
|
|
93
|
+
return [...Object.keys(HOST_DESCRIPTIONS), ...Object.keys(HEADLESS_HOST_DESCRIPTIONS)];
|
|
53
94
|
}
|
|
54
|
-
/** Legal persistent/invocation host: default pi, or a table key. */
|
|
95
|
+
/** Legal persistent/invocation host: default pi, or a table key (any family). */
|
|
55
96
|
export function assertRegisteredHostName(host) {
|
|
56
|
-
if (host === DEFAULT_ROLE_TURN_HOST ||
|
|
97
|
+
if (host === DEFAULT_ROLE_TURN_HOST || lookupHostFamily(host) !== undefined) {
|
|
57
98
|
return host;
|
|
58
99
|
}
|
|
59
100
|
throw new Error(`unregistered host: ${host}`);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Family-dispatch loader for packaged external RoleTurnHost factories (#645).
|
|
3
|
+
* ACP rows → production ACP host; headless rows → production headless host.
|
|
4
|
+
* Unregistered names fail closed before any import.
|
|
5
|
+
*/
|
|
6
|
+
import { lookupHostFamily } from "../host-descriptions.js";
|
|
7
|
+
import { loadProductionAcpHostFactory } from "./load-production-acp-host.js";
|
|
8
|
+
import { loadProductionHeadlessHostFactory } from "./load-production-headless-host.js";
|
|
9
|
+
/** Resolve the production host factory for one registered external host key. */
|
|
10
|
+
export async function loadProductionExternalHostFactory(packageRoot, host) {
|
|
11
|
+
const family = lookupHostFamily(host);
|
|
12
|
+
if (family === "acp") {
|
|
13
|
+
return loadProductionAcpHostFactory(packageRoot, host);
|
|
14
|
+
}
|
|
15
|
+
if (family === "headless") {
|
|
16
|
+
return loadProductionHeadlessHostFactory(packageRoot, host);
|
|
17
|
+
}
|
|
18
|
+
throw new Error(`unregistered host: ${host}`);
|
|
19
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExtension) || function (path, preserveJsx) {
|
|
2
|
+
if (typeof path === "string" && /^\.\.?\//.test(path)) {
|
|
3
|
+
return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
|
|
4
|
+
return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js");
|
|
5
|
+
});
|
|
6
|
+
}
|
|
7
|
+
return path;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Deferred loader for the packaged generic headless RoleTurnHost factory (#645).
|
|
11
|
+
*
|
|
12
|
+
* Public ak-role bin must not statically value-import the production host (or its
|
|
13
|
+
* role-runtime edges). Specifier is runtime-constructed so esbuild leaves this
|
|
14
|
+
* import external (ADR 0052 discovery stays peer-free).
|
|
15
|
+
*/
|
|
16
|
+
import { existsSync } from "node:fs";
|
|
17
|
+
import { join } from "node:path";
|
|
18
|
+
import { pathToFileURL } from "node:url";
|
|
19
|
+
import { lookupHeadlessHostDescription } from "../host-descriptions.js";
|
|
20
|
+
/**
|
|
21
|
+
* Resolve the production headless host factory for one registered headless host
|
|
22
|
+
* key without a static graph edge into the public CLI bundle.
|
|
23
|
+
*/
|
|
24
|
+
export async function loadProductionHeadlessHostFactory(packageRoot, host) {
|
|
25
|
+
const description = lookupHeadlessHostDescription(host);
|
|
26
|
+
if (description === undefined) {
|
|
27
|
+
throw new Error(`unregistered headless host: ${host}`);
|
|
28
|
+
}
|
|
29
|
+
const built = join(packageRoot, "dist/headless-host/production-host.js");
|
|
30
|
+
const source = join(packageRoot, "src/headless-host/production-host.ts");
|
|
31
|
+
const target = existsSync(built) ? built : source;
|
|
32
|
+
const href = pathToFileURL(target).href;
|
|
33
|
+
const mod = (await import(__rewriteRelativeImportExtension(href)));
|
|
34
|
+
const create = mod.createProductionHeadlessRoleTurnHost;
|
|
35
|
+
return (options) => create({ ...options, description });
|
|
36
|
+
}
|