@aiwg/cli 2026.11.2 → 2026.11.4
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/agentic/code/addons/aiwg-hooks/canonical/aiwg-prompt-discovery.yaml +3 -2
- package/agentic/code/addons/aiwg-hooks/hooks/aiwg-prompt-discovery.cjs +12 -9
- package/agentic/code/addons/aiwg-utils/rules/anti-laziness.md +2 -0
- package/agentic/code/addons/composition-engine/lib/runtime.mjs +5 -26
- package/agentic/code/addons/composition-engine/schemas/flow-graph.schema.json +22 -0
- package/agentic/code/providers/capability-matrix.yaml +17 -20
- package/agentic/code/providers/model-capabilities.v1.json +17 -16
- package/dist/src/a2a/hitl-authorization.js +46 -0
- package/dist/src/a2a/hitl-driver.js +5 -5
- package/dist/src/artifacts/browser-export.js +2 -0
- package/dist/src/artifacts/framework-source-digest.js +1 -1
- package/dist/src/artifacts/index-builder.js +5 -25
- package/dist/src/artifacts/index-capability.js +24 -0
- package/dist/src/artifacts/query-engine-discover-output.js +8 -3
- package/dist/src/artifacts/query-engine-rules.js +27 -9
- package/dist/src/artifacts/query-engine-scoring.js +5 -5
- package/dist/src/artifacts/query-engine-show-card.js +5 -1
- package/dist/src/artifacts/query-engine-show-load.js +1 -1
- package/dist/src/artifacts/query-engine-show.js +3 -3
- package/dist/src/artifacts/query-engine-templates.js +10 -4
- package/dist/src/artifacts/query-engine-verbose.js +18 -4
- package/dist/src/artifacts/relations-builder.js +1 -0
- package/dist/src/artifacts/types.js +1 -1
- package/dist/src/cli/handlers/checkpoint-handoff.js +2 -1
- package/dist/src/cli/handlers/dataset.js +17 -0
- package/dist/src/cli/handlers/guided-setup.js +3 -1
- package/dist/src/cli/handlers/refresh-managed-deployment.js +17 -5
- package/dist/src/cli/handlers/rules.js +1 -1
- package/dist/src/cli/handlers/sessions.js +1 -1
- package/dist/src/cli/handlers/steward.js +1 -1
- package/dist/src/cli/handlers/use.js +18 -5
- package/dist/src/cli/handlers/utility-doctor.js +5 -2
- package/dist/src/cli/handlers/workspace.js +1 -1
- package/dist/src/cli/services/deployment-probe-scope.js +40 -0
- package/dist/src/cli/services/deployment-verification.js +5 -6
- package/dist/src/config/aiwg-config.js +6 -0
- package/dist/src/config/authorization-cli.js +61 -3
- package/dist/src/config/cli-help.js +1 -1
- package/dist/src/config/cli.js +4 -2
- package/dist/src/config/decision-config.js +2 -1
- package/dist/src/config/host-resource-runtime.mjs +1 -1
- package/dist/src/config/jev-credential-reference.js +56 -0
- package/dist/src/config/user-config.js +13 -19
- package/dist/src/config/user-registry.js +9 -1
- package/dist/src/config/worker-owner-lock.js +90 -10
- package/dist/src/decision/ask.js +3 -2
- package/dist/src/decision/graph-flow-adapter.js +1 -1
- package/dist/src/decision/jev-credentials.js +22 -0
- package/dist/src/decision/offload.js +1 -1
- package/dist/src/decision/openbao-kv-resolver.mjs +96 -0
- package/dist/src/decision/openbao-runtime.js +101 -0
- package/dist/src/effects/authorization-grant.js +50 -0
- package/dist/src/effects/authorization-store.js +130 -0
- package/dist/src/effects/index.js +2 -0
- package/dist/src/effects/ledger.js +1 -0
- package/dist/src/effects/lifecycle.js +1 -1
- package/dist/src/effects/reader.js +4 -0
- package/dist/src/effects/records.js +4 -0
- package/dist/src/effects/schema.js +2 -0
- package/dist/src/extensions/claude-hooks-installer.js +7 -7
- package/dist/src/extensions/muse-managed-hooks.js +11 -0
- package/dist/src/extensions/user-hook-diagnostics.js +32 -0
- package/dist/src/extensions/verified-hook-command.js +32 -0
- package/dist/src/lint/rule-conflicts.js +52 -0
- package/dist/src/lint/runner.js +3 -0
- package/dist/src/mcp/cli.mjs +3 -1
- package/dist/src/mcp/elicitation.mjs +30 -0
- package/dist/src/mcp/grok-build-config.mjs +1 -1
- package/dist/src/mcp/muse-native-config.mjs +1 -0
- package/dist/src/mcp/server.mjs +2 -0
- package/dist/src/mcp/tools/authorization.mjs +78 -0
- package/dist/src/models/model-capabilities.v1.json +17 -16
- package/dist/src/policy/authorization-capture.js +64 -0
- package/dist/src/policy/authorization-operations.js +108 -0
- package/dist/src/policy/hitl-check.js +3 -2
- package/dist/src/policy/hitl-consume.js +14 -0
- package/dist/src/policy/hitl-durable-store.js +60 -0
- package/dist/src/policy/hitl-durable.js +60 -0
- package/dist/src/policy/hitl-receipt.js +5 -0
- package/dist/src/policy/hitl.js +44 -6
- package/dist/src/process/bounded-child-process.mjs +49 -39
- package/dist/src/providers/capability-matrix.yaml +17 -20
- package/dist/src/providers/deployment-ownership.d.mts +1 -0
- package/dist/src/providers/deployment-ownership.mjs +21 -2
- package/dist/src/providers/grok-build-headless.js +170 -77
- package/dist/src/providers/grok-build-inspect.js +1 -0
- package/dist/src/providers/grok-build-paths.js +2 -0
- package/dist/src/providers/muse-paths.js +4 -2
- package/dist/src/providers/provider-context-contracts.js +12 -4
- package/dist/src/providers/provider-definition-schema.js +6 -0
- package/dist/src/providers/provider-seeds-1.js +3 -3
- package/dist/src/providers/provider-seeds-2.js +6 -4
- package/dist/src/providers/provider-seeds-3.js +6 -6
- package/dist/src/rules/activation.d.mts +2 -0
- package/dist/src/rules/activation.mjs +16 -7
- package/dist/src/rules/inline-budget.d.mts +2 -1
- package/dist/src/rules/inline-budget.mjs +4 -2
- package/dist/src/rules/inventory.js +3 -0
- package/dist/src/rules/precedence.d.mts +6 -0
- package/dist/src/rules/precedence.mjs +49 -0
- package/dist/src/rules/project-precedence.js +73 -0
- package/dist/src/rules/rule-frontmatter.schema.json +15 -0
- package/dist/src/serve/a2a-terminal-observer.js +12 -3
- package/dist/src/serve/mission-hitl.js +20 -1
- package/dist/src/sessions/adapters/grok-build-fallback.js +33 -0
- package/dist/src/sessions/adapters/grok-build-native-records.js +64 -0
- package/dist/src/sessions/adapters/grok-build-native.js +92 -100
- package/dist/src/sessions/adapters/grok-build.js +65 -24
- package/dist/src/sessions/grok-build-cli-output.js +113 -0
- package/dist/src/sessions/grok-build-cli.js +4 -28
- package/dist/src/smiths/context-pipeline/bridge-ownership.js +4 -3
- package/dist/src/smiths/context-pipeline/finalization.js +5 -0
- package/dist/src/smiths/context-pipeline/generator.js +1 -1
- package/dist/src/smiths/context-pipeline/workspace-bootstrap.js +20 -17
- package/dist/src/smiths/context-pipeline/workspace-doctor.js +6 -1
- package/dist/src/smiths/context-pipeline/workspace-document.js +6 -0
- package/dist/src/smiths/context-pipeline/workspace-migration.js +2 -12
- package/dist/src/smiths/hook-bridge/codex-translator.js +11 -14
- package/dist/src/smiths/hook-bridge/codex-trust.js +7 -2
- package/dist/src/smiths/hook-bridge/copilot-translator.js +2 -1
- package/dist/src/smiths/hook-bridge/factory-trust.js +56 -0
- package/dist/src/smiths/hook-bridge/grok-build-translator.js +3 -1
- package/dist/src/smiths/hook-bridge/hermes-prompt-discovery.js +78 -0
- package/dist/src/smiths/hook-bridge/hermes-translator.js +5 -3
- package/dist/src/smiths/hook-bridge/index.js +3 -1
- package/dist/src/smiths/hook-bridge/prompt-discovery-gaps.js +3 -2
- package/package.json +7 -1
- package/tools/agents/deploy-agents.mjs +5 -6
- package/tools/agents/deploy-options.mjs +1 -0
- package/tools/agents/providers/base-frontmatter.mjs +3 -2
- package/tools/agents/providers/claude-post-deploy.mjs +1 -1
- package/tools/agents/providers/codex-post-deploy.mjs +1 -1
- package/tools/agents/providers/generic.mjs +66 -0
- package/tools/agents/providers/grok-build.mjs +3 -1
- package/tools/agents/providers/muse-hooks.mjs +13 -11
- package/tools/agents/providers/muse-prompt-discovery.mjs +5 -1
- package/tools/agents/providers/muse.mjs +2 -1
- package/tools/agents/providers/openclaw.mjs +2 -1
- package/tools/agents/providers/rule-deployment-prepare.mjs +5 -3
- package/tools/agents/providers/rule-deployment-state.mjs +14 -6
- package/tools/agents/providers/rule-startup.mjs +11 -10
- package/tools/agents/providers/staged-directory-reference.mjs +14 -0
- package/tools/agents/providers/user-hooks.mjs +26 -0
- package/tools/cli/authorization-health.mjs +20 -0
- package/tools/cli/decision-offload-report.mjs +2 -0
- package/tools/cli/workspace-status.mjs +7 -0
- package/tools/commands/deploy-prompts-codex.mjs +15 -1
- package/tools/plugin/package-plugins.mjs +6 -1
- package/tools/ralph-external/lib/claude-adapter.mjs +2 -2
- package/vscode-extension/schemas/aiwg.config.v1.json +20 -0
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
// Matches verified durable grants deterministically without trusting descriptor-supplied authority.
|
|
2
|
+
import { assertAuthorizationGrant } from '../effects/authorization-grant.js';
|
|
3
|
+
export const AUTHORIZATION_USE_KIND = 'x.aiwg.authorization-use';
|
|
4
|
+
const compare = (a, b) => a < b ? -1 : a > b ? 1 : 0;
|
|
5
|
+
const forbidden = /(?:^|[^a-z0-9])(?:secrets?|credentials?|tokens?|destructive|irreversible|production|prod|delete|destroy|wipe|drop|override)(?:$|[^a-z0-9])/i;
|
|
6
|
+
export const unsafeDurableAction = (action) => [action.category, action.environment, action.verb ?? '', action.target ?? ''].some(value => forbidden.test(value))
|
|
7
|
+
|| !action.reversible || action.impact === 'high';
|
|
8
|
+
export function matchDurableAuthorization(action, snapshot, now, glob) {
|
|
9
|
+
const revoked = new Set(snapshot.grants.flatMap(({ grant }) => [grant.revokes, grant.supersedes].filter((id) => !!id)));
|
|
10
|
+
const candidates = snapshot.grants.map(entry => {
|
|
11
|
+
const { grant: g } = entry;
|
|
12
|
+
const fields = [];
|
|
13
|
+
try {
|
|
14
|
+
assertAuthorizationGrant(g);
|
|
15
|
+
}
|
|
16
|
+
catch {
|
|
17
|
+
return { entry, fields: ['invalid-grant'] };
|
|
18
|
+
}
|
|
19
|
+
const { targets } = g.scope;
|
|
20
|
+
if (!g.scope.categories.includes(action.category))
|
|
21
|
+
fields.push('category');
|
|
22
|
+
if (!targets.includes(action.target ?? `repo:${action.repo}`))
|
|
23
|
+
fields.push('target');
|
|
24
|
+
if (!targets.includes(`repo:${action.repo}`))
|
|
25
|
+
fields.push('repo');
|
|
26
|
+
// A bare repo name cannot authorize another checkout or workspace with that same repo identity.
|
|
27
|
+
if (!snapshot.workspaces.length || snapshot.workspaces.some(path => !targets.includes(`workspace:${path}`)))
|
|
28
|
+
fields.push('workspace');
|
|
29
|
+
if (!g.scope.environments.includes(action.environment))
|
|
30
|
+
fields.push('environment');
|
|
31
|
+
if (!action.resources.every(path => g.scope.resources.some(pattern => glob(pattern, path))))
|
|
32
|
+
fields.push('resources');
|
|
33
|
+
if (!g.scope.verbs.includes(action.verb ?? action.category.split('.').at(-1)))
|
|
34
|
+
fields.push('verb');
|
|
35
|
+
if (!action.reversible)
|
|
36
|
+
fields.push('reversible');
|
|
37
|
+
if (action.impact === 'high' || (action.impact === 'medium' && g.constraints.maxImpact !== 'medium'))
|
|
38
|
+
fields.push('impact');
|
|
39
|
+
if (now < Date.parse(g.createdAt))
|
|
40
|
+
fields.push('createdAt');
|
|
41
|
+
if (g.expiresAt !== 'until-revoked' && now >= Date.parse(g.expiresAt))
|
|
42
|
+
fields.push('expiresAt');
|
|
43
|
+
if (snapshot.historyUnavailable || g.revocation.state !== 'active' || revoked.has(g.grantId) || g.revokes)
|
|
44
|
+
fields.push('revocation');
|
|
45
|
+
// Free-text conditions are not executable predicates; never assume they have been satisfied.
|
|
46
|
+
if (g.constraints.conditions.length)
|
|
47
|
+
fields.push('conditions');
|
|
48
|
+
if (g.constraints.maxUses !== undefined && (snapshot.usageUnavailable
|
|
49
|
+
|| (snapshot.uses[entry.effectId] ?? 0) >= g.constraints.maxUses))
|
|
50
|
+
fields.push('maxUses');
|
|
51
|
+
return { entry, fields };
|
|
52
|
+
}).sort((a, b) => a.fields.length - b.fields.length || compare(a.entry.grant.grantId, b.entry.grant.grantId)
|
|
53
|
+
|| compare(a.entry.effectId, b.entry.effectId));
|
|
54
|
+
const nearest = candidates[0];
|
|
55
|
+
if (!nearest)
|
|
56
|
+
return {};
|
|
57
|
+
return nearest.fields.length ? { nearest: { grantId: nearest.entry.grant.grantId, fields: nearest.fields } }
|
|
58
|
+
: { match: nearest.entry };
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=hitl-durable.js.map
|
|
@@ -9,14 +9,19 @@ import { fileDigestVerifier } from '../effects/verifiers/file.js';
|
|
|
9
9
|
import { createVerifierRegistry } from '../effects/verifiers/registry.js';
|
|
10
10
|
import { hitlDigest, resolveHitlAuthorization, validHitlAction } from './hitl.js';
|
|
11
11
|
import { HITL_CATEGORIES, HITL_ENVIRONMENTS } from './hitl-types.js';
|
|
12
|
+
import { refreshDurableAuthorization } from './hitl-durable-store.js';
|
|
12
13
|
/** Resolve again at receipt time. A preview result supplied by an agent is never trusted. */
|
|
13
14
|
export async function recordHitlAuthorization(ledger, action, context) {
|
|
15
|
+
context = await refreshDurableAuthorization(ledger, context);
|
|
14
16
|
const resolution = resolveHitlAuthorization(action, context);
|
|
15
17
|
const receipt = {
|
|
16
18
|
kind: 'hitl-authorization', evaluatedAtDigest: hitlDigest(context.now),
|
|
17
19
|
sessionGrantDigest: hitlDigest(context.sessionAuthorization ?? null), ...resolution,
|
|
18
20
|
// Arbitrary user strings become digests, including paths, repo identity and profile names.
|
|
19
21
|
matchedProfile: resolution.matchedProfile ? hitlDigest(resolution.matchedProfile) : null,
|
|
22
|
+
// Diagnostic grant IDs may be arbitrary strings; only verified grant links are stored verbatim.
|
|
23
|
+
...(resolution.nearestGrant ? { nearestGrant: { ...resolution.nearestGrant, grantId: hitlDigest(resolution.nearestGrant.grantId) },
|
|
24
|
+
reason: 'durable-grant-scope-mismatch' } : {}),
|
|
20
25
|
action: validHitlAction(action) ? {
|
|
21
26
|
category: HITL_CATEGORIES.find(category => category === action.category) ?? 'restricted',
|
|
22
27
|
descriptorDigest: hitlDigest(action), categoryDigest: hitlDigest(action.category),
|
package/dist/src/policy/hitl.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { createHash } from 'node:crypto';
|
|
3
3
|
import { HITL_CATEGORIES, HITL_ENVIRONMENTS } from './hitl-types.js';
|
|
4
4
|
import { validateHitlPolicy } from './hitl-validation.js';
|
|
5
|
+
import { matchDurableAuthorization, unsafeDurableAction } from './hitl-durable.js';
|
|
5
6
|
export function hitlDigest(value) {
|
|
6
7
|
const canonical = (v) => Array.isArray(v) ? v.map(canonical)
|
|
7
8
|
: v && typeof v === 'object' ? Object.fromEntries(Object.entries(v).filter(([, x]) => x !== undefined)
|
|
@@ -19,9 +20,11 @@ export function validHitlAction(value) {
|
|
|
19
20
|
}
|
|
20
21
|
function actionFieldsValid(a) {
|
|
21
22
|
const keys = ['category', 'repo', 'environment', 'resources', 'reversible', 'impact'];
|
|
22
|
-
const binding = ['actor', 'inputDigest'];
|
|
23
|
+
const binding = ['actor', 'inputDigest', 'target', 'verb'];
|
|
23
24
|
return Object.keys(a).every(k => [...keys, ...binding].includes(k)) && keys.every(k => Object.hasOwn(a, k))
|
|
24
|
-
&& (a.category !== 'repo.edit' || (
|
|
25
|
+
&& (a.category !== 'repo.edit' || (typeof a.actor === 'string' && typeof a.inputDigest === 'string'))
|
|
26
|
+
&& (a.target === undefined || (typeof a.target === 'string' && /^[A-Za-z0-9][A-Za-z0-9_.:/@#=-]{0,255}$/.test(a.target)))
|
|
27
|
+
&& (a.verb === undefined || (typeof a.verb === 'string' && /^[a-z][a-z0-9]*(?:[.-][a-z0-9]+)*$/.test(a.verb)))
|
|
25
28
|
&& (a.actor === undefined || (typeof a.actor === 'string' && identifier.test(a.actor)))
|
|
26
29
|
&& (a.inputDigest === undefined || (typeof a.inputDigest === 'string' && /^sha256:[a-f0-9]{64}$/.test(a.inputDigest)))
|
|
27
30
|
&& [a.category, a.repo, a.environment].every(x => typeof x === 'string' && identifier.test(x))
|
|
@@ -29,7 +32,7 @@ function actionFieldsValid(a) {
|
|
|
29
32
|
&& typeof a.reversible === 'boolean' && ['low', 'medium', 'high'].includes(a.impact);
|
|
30
33
|
}
|
|
31
34
|
/** Deliberately small glob language: * within a segment; ** crosses directories; ? one character. */
|
|
32
|
-
function glob(pattern, path) {
|
|
35
|
+
export function glob(pattern, path) {
|
|
33
36
|
// Memoized matching bounds work by pattern length × path length, without regex backtracking.
|
|
34
37
|
const memo = new Map();
|
|
35
38
|
const match = (i, j) => {
|
|
@@ -72,13 +75,16 @@ function grant(p, a, now) {
|
|
|
72
75
|
}
|
|
73
76
|
export function resolveHitlAuthorization(action, context) {
|
|
74
77
|
const policyVersion = hitlPolicyVersion(context.layers);
|
|
75
|
-
|
|
78
|
+
let nearestGrant;
|
|
79
|
+
const result = (decision, reason, provenance, matchedProfile = null) => ({ decision,
|
|
80
|
+
reason: nearestGrant && decision === 'escalate'
|
|
81
|
+
? `${reason}; nearest-grant:${nearestGrant.grantId}; differing-fields:${nearestGrant.fields.join(',')}` : reason,
|
|
82
|
+
policyVersion, matchedProfile, provenance, ...(nearestGrant && decision === 'escalate' ? { nearestGrant } : {}) });
|
|
76
83
|
if (context.platform)
|
|
77
84
|
return result(context.platform === 'deny' ? 'deny' : 'escalate', 'platform-constraint', 'platform');
|
|
78
85
|
if (!validHitlAction(action))
|
|
79
86
|
return result('escalate', 'invalid-action-descriptor', 'default');
|
|
80
|
-
if (
|
|
81
|
-
|| !action.reversible || action.impact === 'high')
|
|
87
|
+
if (unsafeDurableAction(action))
|
|
82
88
|
return result('escalate', 'safety-category-requires-explicit-review', 'platform');
|
|
83
89
|
// Revalidate even when invoked directly with objects that bypassed the config loader.
|
|
84
90
|
if (context.layers.some(l => validateHitlPolicy(l.policy).length))
|
|
@@ -88,6 +94,8 @@ export function resolveHitlAuthorization(action, context) {
|
|
|
88
94
|
const now = Date.parse(context.now);
|
|
89
95
|
if (!Number.isFinite(now))
|
|
90
96
|
return result('escalate', 'invalid-clock', 'default');
|
|
97
|
+
if (context.durableAuthorization?.failures.length)
|
|
98
|
+
return result('escalate', 'authorization-ledger-invalid', 'default');
|
|
91
99
|
const session = context.sessionAuthorization;
|
|
92
100
|
if (session?.source === 'session-user') {
|
|
93
101
|
const probe = { version: '1', enabled: true, reviewedAt: context.now, maxAgeSeconds: 1,
|
|
@@ -99,6 +107,36 @@ export function resolveHitlAuthorization(action, context) {
|
|
|
99
107
|
}
|
|
100
108
|
if (context.expectedPolicyVersion && policyVersion !== context.expectedPolicyVersion)
|
|
101
109
|
return result('escalate', 'stale-policy-version', 'project-policy');
|
|
110
|
+
if (context.durableAuthorization) {
|
|
111
|
+
const durable = matchDurableAuthorization(action, context.durableAuthorization, now, glob);
|
|
112
|
+
nearestGrant = durable.nearest;
|
|
113
|
+
// An independent human grant needs no profile, but cannot bypass a governing review/revocation.
|
|
114
|
+
for (const { policy: p } of durable.match ? context.layers : []) {
|
|
115
|
+
if (!p)
|
|
116
|
+
continue;
|
|
117
|
+
if (!p.enabled)
|
|
118
|
+
return result('escalate', 'policy-revoked', 'project-policy');
|
|
119
|
+
if (now >= Date.parse(p.expiresAt))
|
|
120
|
+
return result('escalate', 'policy-expired', 'project-policy');
|
|
121
|
+
const reviewed = Date.parse(p.reviewedAt);
|
|
122
|
+
if (reviewed > now || now - reviewed >= p.maxAgeSeconds * 1000)
|
|
123
|
+
return result('escalate', 'stale-policy-review', 'project-policy');
|
|
124
|
+
if (p.requireReview.some(s => selected(s, action)))
|
|
125
|
+
return result('escalate', 'policy-requires-review', 'project-policy');
|
|
126
|
+
}
|
|
127
|
+
if (durable.match) {
|
|
128
|
+
const { grant: g, effectId, recordHash } = durable.match;
|
|
129
|
+
const policyExpiry = context.layers.flatMap(({ policy: p }) => p ? [Date.parse(p.expiresAt),
|
|
130
|
+
Date.parse(p.reviewedAt) + p.maxAgeSeconds * 1000] : []);
|
|
131
|
+
// Even until-revoked grants issue finite receipts; every consumption still reloads revocations.
|
|
132
|
+
const expiresAt = new Date(Math.min(g.expiresAt === 'until-revoked' ? now + 86400_000 : Date.parse(g.expiresAt), ...policyExpiry)).toISOString();
|
|
133
|
+
return { ...result('auto-authorized', 'durable-user-authorization', 'durable-user'), expiresAt,
|
|
134
|
+
authorizationGrant: { grantId: g.grantId, effectId, recordHash } };
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
if (!HITL_CATEGORIES.some(c => c === action.category) || !HITL_ENVIRONMENTS.some(e => e === action.environment)) {
|
|
138
|
+
return result('escalate', 'safety-category-requires-explicit-review', 'platform');
|
|
139
|
+
}
|
|
102
140
|
if (!context.layers.length)
|
|
103
141
|
return result('escalate', 'no-project-policy', 'default');
|
|
104
142
|
let matched = null;
|
|
@@ -10,6 +10,10 @@
|
|
|
10
10
|
* normal Node `ETIMEDOUT` error/result with a message that names the
|
|
11
11
|
* command, tier and bound.
|
|
12
12
|
*
|
|
13
|
+
* Stdin defaults to ignore. Synchronous `input` is delivered through a private
|
|
14
|
+
* mode-0600 temporary file descriptor, closed and removed after each call.
|
|
15
|
+
* This avoids synchronous stdin pipes that fail in Codex sandboxes (#4032).
|
|
16
|
+
*
|
|
13
17
|
* Tiers (see `SYNC_PROCESS_TIER_BOUNDS_MS`):
|
|
14
18
|
* - `quick` 30s — local queries: git status/rev-parse/config, version
|
|
15
19
|
* probes, `which`/`where`, `df`, tmux queries.
|
|
@@ -75,6 +79,9 @@ import {
|
|
|
75
79
|
execFileSync as nodeExecFileSync,
|
|
76
80
|
spawnSync as nodeSpawnSync,
|
|
77
81
|
} from 'node:child_process';
|
|
82
|
+
import { closeSync, mkdtempSync, openSync, rmSync, writeFileSync } from 'node:fs';
|
|
83
|
+
import { tmpdir } from 'node:os';
|
|
84
|
+
import { join } from 'node:path';
|
|
78
85
|
import { signalChild } from './signal-child.mjs';
|
|
79
86
|
|
|
80
87
|
/** Env var that raises or disables the `long` tier bound. `0` disables it (no timeout). */
|
|
@@ -208,45 +215,41 @@ function isParentStdinDescriptor(value) {
|
|
|
208
215
|
return value === 'inherit' || value === 0 || value === process.stdin;
|
|
209
216
|
}
|
|
210
217
|
|
|
211
|
-
/**
|
|
212
|
-
* A bounded call never inherits stdin; stdout/stderr may still be inherited
|
|
213
|
-
* for progress output. When the caller supplies `input`, an inherited
|
|
214
|
-
* stdin form is normalized to `'pipe'` instead of `'ignore'` — `input`
|
|
215
|
-
* needs a real pipe to deliver its payload through, and `'ignore'` would
|
|
216
|
-
* silently drop it (#3062 B/C finding 9). `options` is otherwise left
|
|
217
|
-
* untouched when stdin was not going to be inherited anyway.
|
|
218
|
-
*
|
|
219
|
-
* @param {Record<string, unknown>} options
|
|
220
|
-
* @returns {Record<string, unknown>}
|
|
221
|
-
*/
|
|
218
|
+
/** Normalize stdin without changing output streams or caller-owned options. */
|
|
222
219
|
function withoutInheritedStdin(options) {
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
// `stdio: 'inherit'`/fd `0`/`process.stdin` could still leave stdin
|
|
229
|
-
// connected to the parent's real stdin instead of the pipe `input`
|
|
230
|
-
// is written to). stdout/stderr and the payload itself are untouched.
|
|
231
|
-
if (options.stdio === 'inherit') {
|
|
232
|
-
return { ...options, stdio: ['pipe', 'inherit', 'inherit'] };
|
|
233
|
-
}
|
|
234
|
-
if (Array.isArray(options.stdio) && isParentStdinDescriptor(options.stdio[0])) {
|
|
235
|
-
const stdio = options.stdio.slice();
|
|
236
|
-
stdio[0] = 'pipe';
|
|
237
|
-
return { ...options, stdio };
|
|
238
|
-
}
|
|
239
|
-
return options;
|
|
240
|
-
}
|
|
241
|
-
if (options.stdio === 'inherit') {
|
|
242
|
-
return { ...options, stdio: ['ignore', 'inherit', 'inherit'] };
|
|
220
|
+
const stdio = Array.isArray(options.stdio)
|
|
221
|
+
? options.stdio.slice()
|
|
222
|
+
: [options.stdio, options.stdio ?? 'pipe', options.stdio ?? 'pipe'];
|
|
223
|
+
if (stdio[0] == null || stdio[0] === 'pipe' || stdio[0] === 'overlapped' || isParentStdinDescriptor(stdio[0])) {
|
|
224
|
+
stdio[0] = options.input === undefined ? 'ignore' : 'pipe';
|
|
243
225
|
}
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
226
|
+
return { ...options, stdio };
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
/** Deliver synchronous input without Node's sandbox-sensitive stdin pipe (#4032). */
|
|
230
|
+
function withSyncStdin(options, run) {
|
|
231
|
+
if (options.input === undefined) return run(options);
|
|
232
|
+
// Never fall back to Node's synchronous input pipe: in sandboxes it blocks the
|
|
233
|
+
// child until the timeout. Without writable temp storage the call fails fast;
|
|
234
|
+
// boundedSpawnSync turns this into a returned error, as spawnSync does.
|
|
235
|
+
let directory;
|
|
236
|
+
try { directory = mkdtempSync(join(tmpdir(), 'aiwg-sync-stdin-')); }
|
|
237
|
+
catch (error) { throw Object.assign(error, { aiwgStdinTempUnavailable: true }); }
|
|
238
|
+
let fd;
|
|
239
|
+
try {
|
|
240
|
+
const filename = join(directory, 'stdin');
|
|
241
|
+
writeFileSync(filename, options.input, {
|
|
242
|
+
flag: 'wx', mode: 0o600, encoding: options.encoding ?? 'utf8',
|
|
243
|
+
});
|
|
244
|
+
fd = openSync(filename, 'r');
|
|
245
|
+
const { input: _input, ...nodeOptions } = options;
|
|
246
|
+
nodeOptions.stdio = options.stdio.slice();
|
|
247
|
+
nodeOptions.stdio[0] = fd;
|
|
248
|
+
return run(nodeOptions);
|
|
249
|
+
} finally {
|
|
250
|
+
try { if (fd !== undefined) closeSync(fd); }
|
|
251
|
+
finally { rmSync(directory, { recursive: true, force: true }); }
|
|
248
252
|
}
|
|
249
|
-
return options;
|
|
250
253
|
}
|
|
251
254
|
|
|
252
255
|
/**
|
|
@@ -328,7 +331,7 @@ export function boundedExecSync(command, tier, options) {
|
|
|
328
331
|
const boundMs = effectiveTimeoutMs(tier, options);
|
|
329
332
|
const nodeOptions = toNodeOptions(options, boundMs);
|
|
330
333
|
try {
|
|
331
|
-
return nodeExecSync(command,
|
|
334
|
+
return withSyncStdin(nodeOptions, prepared => nodeExecSync(command, prepared));
|
|
332
335
|
} catch (error) {
|
|
333
336
|
throw enrichTimeoutError(error, { description: command, tier, boundMs });
|
|
334
337
|
}
|
|
@@ -351,7 +354,7 @@ export function boundedExecFileSync(file, args, tier, options) {
|
|
|
351
354
|
const boundMs = effectiveTimeoutMs(tier, options);
|
|
352
355
|
const nodeOptions = toNodeOptions(options, boundMs);
|
|
353
356
|
try {
|
|
354
|
-
return nodeExecFileSync(file, args,
|
|
357
|
+
return withSyncStdin(nodeOptions, prepared => nodeExecFileSync(file, args, prepared));
|
|
355
358
|
} catch (error) {
|
|
356
359
|
throw enrichTimeoutError(error, { description: describeCommand(file, args), tier, boundMs });
|
|
357
360
|
}
|
|
@@ -383,7 +386,14 @@ export function boundedSpawnSync(command, args, tier, options) {
|
|
|
383
386
|
assertValidTier(tier);
|
|
384
387
|
const boundMs = effectiveTimeoutMs(tier, options);
|
|
385
388
|
const nodeOptions = toNodeOptions(options, boundMs);
|
|
386
|
-
|
|
389
|
+
let result;
|
|
390
|
+
try {
|
|
391
|
+
result = withSyncStdin(nodeOptions, prepared => nodeSpawnSync(command, args, prepared));
|
|
392
|
+
} catch (error) {
|
|
393
|
+
// Like spawnSync, report a missing temp directory for input as a returned error; other throws propagate.
|
|
394
|
+
if (!error?.aiwgStdinTempUnavailable) throw error;
|
|
395
|
+
result = { pid: 0, output: [null, null, null], stdout: null, stderr: null, status: null, signal: null, error };
|
|
396
|
+
}
|
|
387
397
|
enrichTimeoutError(result.error, { description: describeCommand(command, args), tier, boundMs, signal: result.signal });
|
|
388
398
|
return result;
|
|
389
399
|
}
|
|
@@ -26,10 +26,10 @@ providers:
|
|
|
26
26
|
probe_budget: { status: authorized, calls: 3, tokens: 30000, authorized_by: operator, authorized_at: "2026-10-07", hosts: [titan, noodle] }
|
|
27
27
|
coverage:
|
|
28
28
|
profile_issue: "roctinam/aiwg#2900"
|
|
29
|
-
source_date: "2026-
|
|
29
|
+
source_date: "2026-11-07"
|
|
30
30
|
live_qualified: false
|
|
31
31
|
sources:
|
|
32
|
-
- "host-help: claude 2.1.
|
|
32
|
+
- "host-help: claude 2.1.319 on titan (--version/--help/-p --help only)"
|
|
33
33
|
- "tools/ralph-external/lib/claude-adapter.mjs"
|
|
34
34
|
status: stable
|
|
35
35
|
daemon_tier: unsupported
|
|
@@ -549,7 +549,7 @@ providers:
|
|
|
549
549
|
scope: in
|
|
550
550
|
identity: runtime-configured-only
|
|
551
551
|
evidence: R
|
|
552
|
-
channel: "grok -p --output-format streaming-json; bounded parser
|
|
552
|
+
channel: "grok -p --output-format streaming-json; 1.0.77 adds --no-auto-update; bounded parser (model/effort pins unverified by captures)"
|
|
553
553
|
fanout: unknown
|
|
554
554
|
probe_budget: { status: authorized, calls: 3, tokens: 30000, authorized_by: operator, authorized_at: "2026-10-07", hosts: [titan, noodle] }
|
|
555
555
|
coverage:
|
|
@@ -560,35 +560,32 @@ providers:
|
|
|
560
560
|
- "src/providers/grok-build-headless.ts"
|
|
561
561
|
status: experimental
|
|
562
562
|
# xAI Grok Build CLI/TUI. Distinct from Grok Bot (`grokbot`).
|
|
563
|
-
# #2577:
|
|
564
|
-
#
|
|
565
|
-
# test/unit/providers/grok-build-
|
|
566
|
-
#
|
|
567
|
-
#
|
|
568
|
-
# and grok-build-acp.test.ts. ACP does not establish a daemon lifecycle.
|
|
569
|
-
# No fixture supports native cron, multi-agent teams, mission control,
|
|
570
|
-
# or AIWG behavior registration; those claims remain false.
|
|
563
|
+
# #2577: every claim and its limits are recorded in
|
|
564
|
+
# docs/providers/grok-build-native-agents.md (1.0.77 evidence table).
|
|
565
|
+
# Captured headless shapes: test/unit/providers/grok-build-headless.test.ts.
|
|
566
|
+
# Agent compilation, native fan-out/worktrees and ACP remain unverified by
|
|
567
|
+
# these captures; pre-existing synthetic tests establish AIWG behavior only.
|
|
571
568
|
daemon_tier: unsupported
|
|
572
569
|
daemon_pty_adapter: false
|
|
573
570
|
artifact_paths:
|
|
574
|
-
agents: .grok/agents/ #
|
|
571
|
+
agents: .grok/agents/ # writer path; native frontmatter unverified by captures
|
|
575
572
|
commands: null
|
|
576
573
|
skills: .grok/skills/
|
|
577
574
|
skills_cross_agent: .grok/.aiwg/skills/ # --copy-all opt-in mirror
|
|
578
575
|
rules: "Indexed: aiwg show rule + AGENTS.md / host .grok/rules (AIWG writer deferred #2577)"
|
|
579
576
|
behaviors: null
|
|
580
577
|
native_features:
|
|
581
|
-
cron: false
|
|
582
|
-
agent_teams: false
|
|
583
|
-
tasks:
|
|
584
|
-
mcp: true
|
|
585
|
-
behaviors: false
|
|
586
|
-
mission_control: false
|
|
587
|
-
daemon: false
|
|
578
|
+
cron: false # unverified: needs recurring-loop execution capture
|
|
579
|
+
agent_teams: false # unverified: needs team lifecycle capture
|
|
580
|
+
tasks: false # unverified: headless tool calls do not prove background task lifecycle
|
|
581
|
+
mcp: true # fixture-backed config only: grok-build-native-integration.test.ts; live MCP unverified
|
|
582
|
+
behaviors: false # unverified: needs behavior registration/execution capture
|
|
583
|
+
mission_control: false # unverified: needs mission lifecycle capture
|
|
584
|
+
daemon: false # unverified: ACP is separate and needs agent-stdio capture
|
|
588
585
|
emulation:
|
|
589
586
|
cron: null
|
|
590
587
|
agent_teams: aiwg-mc
|
|
591
|
-
tasks:
|
|
588
|
+
tasks: aiwg-mc
|
|
592
589
|
mcp: null
|
|
593
590
|
behaviors: aiwg-mc
|
|
594
591
|
mission_control: aiwg-mc
|
|
@@ -23,6 +23,7 @@ export class DeploymentOutputState {
|
|
|
23
23
|
export type DeploymentOutputSnapshot = Map<string, Buffer | DeploymentOutputState>;
|
|
24
24
|
export function outputDigest(entry: Buffer | DeploymentOutputState | undefined): string | undefined;
|
|
25
25
|
export function sameOutput(a: Buffer | DeploymentOutputState | undefined, b: Buffer | DeploymentOutputState | undefined): boolean;
|
|
26
|
+
export function legacyCodexPromptOwner(file: string, entry: Buffer | DeploymentOutputState | undefined): string | undefined;
|
|
26
27
|
export function captureDeploymentOutputs(roots: PathLike[], options?: { previous?: DeploymentOutputSnapshot }): DeploymentOutputSnapshot;
|
|
27
28
|
export function recordDeploymentOutputs(before: DeploymentOutputSnapshot, roots: PathLike[], opts?: DeploymentOwnershipOptions): void;
|
|
28
29
|
export function refreshSettingsDigests(record: { settings?: Record<string, unknown> }): void;
|
|
@@ -58,6 +58,22 @@ const digestOf = entry => {
|
|
|
58
58
|
export const outputDigest = entry => digestOf(entry);
|
|
59
59
|
/** Content equality; a stat-only entry never equals a different entry. */
|
|
60
60
|
export const sameOutput = (a, b) => a != null && b != null && (a === b || (digestOf(a) !== undefined && digestOf(a) === digestOf(b)));
|
|
61
|
+
|
|
62
|
+
// v2026.10.0–v2026.10.19: deploy-prompts-codex.mjs emitted these exact
|
|
63
|
+
// unmarked bytes (description frontmatter + trimmed command body, no final LF).
|
|
64
|
+
// Sources: addons/{dataset-intelligence,schema-governance,aiwg-utils}/commands/
|
|
65
|
+
// {dataset,schema,sessions}.md. Fixtures retain v2026.10.3 sources and outputs.
|
|
66
|
+
const LEGACY_CODEX_PROMPTS = {
|
|
67
|
+
'aiwg-dataset.md': ['sha256:652469f0023144af5597cb6571f9ff498e5a11e5795de4074480f814dc106a87', 'dataset-intelligence'],
|
|
68
|
+
'aiwg-schema.md': ['sha256:65000b74de7149b70229f5c8409e2c6a6c4d5e45086f776e0db2ae8633c176f9', 'schema-governance'],
|
|
69
|
+
'aiwg-sessions.md': ['sha256:ad0591041932dbbb8a08a5d0e946490b2ef3e18a1b65f610df3555b6b67eb690', 'aiwg-utils'],
|
|
70
|
+
};
|
|
71
|
+
/** Recognize only historical bytes at their original Codex prompt names. */
|
|
72
|
+
export function legacyCodexPromptOwner(file, entry) {
|
|
73
|
+
if (path.basename(path.dirname(file)) !== 'prompts' || path.basename(path.dirname(path.dirname(file))) !== '.codex') return undefined;
|
|
74
|
+
const known = LEGACY_CODEX_PROMPTS[path.basename(file)];
|
|
75
|
+
return known && known[0] === digestOf(entry) ? known[1] : undefined;
|
|
76
|
+
}
|
|
61
77
|
const bytesOf = (file, entry) => {
|
|
62
78
|
if (entry == null || Buffer.isBuffer(entry)) return entry;
|
|
63
79
|
throw new Error(`Deployment snapshot did not retain bytes for ${file}`);
|
|
@@ -270,10 +286,13 @@ export function recordDeploymentOutputs(before, roots, opts = {}) {
|
|
|
270
286
|
if (path.basename(file) === SIDECAR || /(?:^|[/\\])aiwg\.config$/.test(file)
|
|
271
287
|
|| /(?:\.bak\.|\.aiwg-backup-)/.test(path.basename(file))) continue;
|
|
272
288
|
if (preserved.has(file)) continue;
|
|
289
|
+
const legacyOwner = opts.provider === 'codex'
|
|
290
|
+
&& !parse(before.get(path.join(path.dirname(file), SIDECAR))).managed?.[path.basename(file)]
|
|
291
|
+
&& legacyCodexPromptOwner(file, before.get(file));
|
|
273
292
|
const changed = !sameOutput(before.get(file), bytes);
|
|
274
293
|
const declaration = declared.get(file);
|
|
275
294
|
if (opts.onlyDeclared && !declaration) continue;
|
|
276
|
-
if (!changed && !declaration && !opts.writtenFiles?.includes(file)) continue;
|
|
295
|
+
if (!changed && !declaration && !legacyOwner && !opts.writtenFiles?.includes(file)) continue;
|
|
277
296
|
// Existing integrity receipts that disagree with bytes never bless operator edits.
|
|
278
297
|
if (declaration?.entry.hash && declaration.entry.hash !== digestOf(bytes)) continue;
|
|
279
298
|
let skillRoot = path.dirname(file);
|
|
@@ -298,7 +317,7 @@ export function recordDeploymentOutputs(before, roots, opts = {}) {
|
|
|
298
317
|
|| skillReceipt.managed?.['SKILL.md']?.frameworkSlug;
|
|
299
318
|
const generatedIndex = /^RULES-(?:INDEX|ONDEMAND)\.(?:md|mdc)$/.test(path.basename(file));
|
|
300
319
|
const kind = generatedIndex ? 'rule-index' : current.kind || artifactKind(file);
|
|
301
|
-
const selectedOwner = opts.provider === 'flue' ? owner : sourceOwner || (opts.onlyDeclared ? current.owners?.[0] : owner);
|
|
320
|
+
const selectedOwner = opts.provider === 'flue' ? owner : sourceOwner || legacyOwner || (opts.onlyDeclared ? current.owners?.[0] : owner);
|
|
302
321
|
if (!selectedOwner) {
|
|
303
322
|
console.warn(`Ownership not recorded for ${file}: no framework owner resolved.`);
|
|
304
323
|
continue;
|