@aiwg/cli 2026.10.15 → 2026.10.16
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/providers/pi/aiwg-bridge.ts +45 -7
- package/dist/src/artifacts/citation-parser.js +7 -6
- package/dist/src/artifacts/corpus-tools/citation-densify.js +4 -2
- package/dist/src/artifacts/corpus-tools/cli.js +8 -3
- package/dist/src/artifacts/corpus-tools/discovery-log.js +26 -24
- package/dist/src/artifacts/corpus-tools/expand-cli.js +3 -2
- package/dist/src/artifacts/corpus-tools/expand-dates.js +107 -0
- package/dist/src/artifacts/corpus-tools/expand-queue.js +4 -1
- package/dist/src/artifacts/corpus-tools/expand-review.js +104 -0
- package/dist/src/artifacts/corpus-tools/expand-state.js +17 -1
- package/dist/src/artifacts/corpus-tools/expand.js +16 -17
- package/dist/src/artifacts/corpus-tools/induction-audit.js +7 -6
- package/dist/src/artifacts/corpus-tools/integrity-scan.js +3 -3
- package/dist/src/artifacts/corpus-tools/radar-shared.js +7 -9
- package/dist/src/artifacts/corpus-tools/ref-files.js +11 -0
- package/dist/src/artifacts/corpus-tools/resolve-cli.js +11 -3
- package/dist/src/artifacts/corpus-tools/resolve.js +23 -9
- package/dist/src/artifacts/corpus-tools/retrieval-lab.js +2 -1
- package/dist/src/artifacts/corpus-tools/sidecar-lint.js +4 -4
- package/dist/src/artifacts/corpus-tools/sidecar-repair.js +2 -1
- package/dist/src/artifacts/corpus-views/ref-parser.js +3 -17
- package/dist/src/artifacts/graph-query.js +5 -3
- package/dist/src/artifacts/hybrid-query.js +11 -2
- package/dist/src/artifacts/index-refresh.js +2 -0
- package/dist/src/cli/handlers/daemon.js +17 -1
- package/dist/src/cli/handlers/doctor-args.js +10 -5
- package/dist/src/cli/handlers/doctor-help.js +4 -1
- package/dist/src/cli/handlers/index.js +2 -2
- package/dist/src/cli/handlers/models-resource-sample.js +10 -0
- package/dist/src/cli/handlers/models.js +3 -2
- package/dist/src/cli/handlers/regenerate.js +8 -16
- package/dist/src/cli/handlers/sessions.js +7 -7
- package/dist/src/cli/handlers/subcommands.js +8 -0
- package/dist/src/cli/handlers/update.js +157 -0
- package/dist/src/cli/handlers/use.js +14 -4
- package/dist/src/cli/handlers/utilities.js +3 -560
- package/dist/src/cli/handlers/utility-doctor.js +412 -0
- package/dist/src/cli/services/deployment-verification.js +0 -1
- package/dist/src/config/aiwg-config.js +2 -1
- package/dist/src/config/authorization-cli.js +7 -3
- package/dist/src/config/dispatch-thresholds-runtime.d.mts +3 -2
- package/dist/src/config/dispatch-thresholds-runtime.mjs +17 -7
- package/dist/src/config/framework-aliases.js +12 -0
- package/dist/src/config/host-resource-report.d.mts +19 -0
- package/dist/src/config/host-resource-report.mjs +80 -0
- package/dist/src/config/host-resource-runtime.d.mts +34 -0
- package/dist/src/config/host-resource-runtime.mjs +293 -0
- package/dist/src/config/installed-selection.js +22 -0
- package/dist/src/config/worker-invocation-marker.d.mts +1 -0
- package/dist/src/config/worker-invocation-marker.mjs +2 -0
- package/dist/src/decision/heldout/access.js +74 -0
- package/dist/src/decision/heldout/calibration.js +1 -0
- package/dist/src/decision/heldout/collector.js +8 -1
- package/dist/src/effects/verifiers/file.js +22 -5
- package/dist/src/extensions/claude-attribution.js +82 -0
- package/dist/src/extensions/claude-hooks-installer.js +115 -69
- package/dist/src/extensions/commands/daemon.js +109 -0
- package/dist/src/extensions/commands/definitions.js +5 -89
- package/dist/src/gates/heldout.js +17 -7
- package/dist/src/lint/check-patterns.js +163 -0
- package/dist/src/lint/checks.js +268 -0
- package/dist/src/lint/reference-resolution.js +54 -0
- package/dist/src/lint/runner.js +3 -465
- package/dist/src/mcp/helpers.mjs +11 -1
- package/dist/src/memory/project-registry.js +44 -4
- package/dist/src/models/worker-plan.js +36 -5
- package/dist/src/models/wrapper-deployment.js +25 -12
- package/dist/src/models/wrapper-enforcement.js +47 -7
- package/dist/src/network-analysis/research.js +2 -1
- package/dist/src/policy/hitl-check.js +14 -4
- package/dist/src/policy/hitl-consume.js +54 -0
- package/dist/src/policy/hitl-receipt.js +2 -0
- package/dist/src/policy/hitl.js +11 -3
- package/dist/src/providers/provider-context-contracts.js +162 -0
- package/dist/src/providers/provider-definition-schema.js +136 -0
- package/dist/src/providers/provider-definitions.js +8 -1298
- package/dist/src/providers/provider-seeds-1.js +360 -0
- package/dist/src/providers/provider-seeds-2.js +387 -0
- package/dist/src/providers/provider-seeds-3.js +262 -0
- package/dist/src/research/clients/arxiv.js +4 -30
- package/dist/src/research/clients/base.js +48 -22
- package/dist/src/research/identity.js +34 -2
- package/dist/src/research/query-cli.js +3 -87
- package/dist/src/research/query-options.js +87 -0
- package/dist/src/research/reference-match.js +70 -24
- package/dist/src/research/services/acquisition.js +9 -7
- package/dist/src/research/services/citation.js +5 -2
- package/dist/src/research/types.js +2 -0
- package/dist/src/serve/mission-conductor.js +48 -4
- package/dist/src/sessions/adapters/grok-build-native.js +23 -0
- package/dist/src/sessions/adapters/grok-build.js +14 -7
- package/dist/src/sessions/workspace-discovery.js +5 -5
- package/dist/src/smiths/context-pipeline/aiwg-md.js +16 -46
- package/dist/src/smiths/context-pipeline/claude-hook.js +1 -1
- package/dist/src/smiths/context-pipeline/code-regions.js +28 -0
- package/dist/src/smiths/context-pipeline/finalization.js +81 -51
- package/dist/src/smiths/context-pipeline/generator.js +9 -10
- package/dist/src/smiths/context-pipeline/managed-hook.js +1 -1
- package/dist/src/smiths/context-pipeline/muse-bridge.js +2 -2
- package/dist/src/smiths/context-pipeline/provider-policy.js +6 -12
- package/dist/src/smiths/context-pipeline/workspace-audit.js +299 -0
- package/dist/src/smiths/context-pipeline/workspace-bootstrap.js +148 -0
- package/dist/src/smiths/context-pipeline/workspace-context-shared.js +111 -0
- package/dist/src/smiths/context-pipeline/workspace-context.js +8 -1373
- package/dist/src/smiths/context-pipeline/workspace-doctor.js +192 -0
- package/dist/src/smiths/context-pipeline/workspace-document.js +201 -0
- package/dist/src/smiths/context-pipeline/workspace-extraction.js +205 -0
- package/dist/src/smiths/context-pipeline/workspace-migration.js +250 -0
- package/package.json +10 -1
- package/schemas/decision/D29Study.v10.schema.json +65 -0
- package/tools/agents/deploy-agents.mjs +10 -0
- package/tools/agents/providers/claude-post-deploy.mjs +12 -1
- package/tools/agents/providers/context-write.mjs +4 -0
- package/tools/agents/providers/pi.mjs +3 -1
- package/tools/agents/providers/rule-delivery-surface.mjs +332 -0
- package/tools/agents/providers/rule-delivery.mjs +20 -1144
- package/tools/agents/providers/rule-deployment-commit.mjs +144 -0
- package/tools/agents/providers/rule-deployment-prepare.mjs +452 -0
- package/tools/agents/providers/rule-deployment-state.mjs +300 -0
- package/tools/daemon/README.md +511 -0
- package/tools/daemon/adapters/base-adapter.mjs +84 -0
- package/tools/daemon/adapters/webhook-adapter.mjs +107 -0
- package/tools/daemon/agent-supervisor.mjs +299 -0
- package/tools/daemon/automation-engine.mjs +310 -0
- package/tools/daemon/autonomous-engine.mjs +346 -0
- package/tools/daemon/behavior-loader.mjs +316 -0
- package/tools/daemon/behavior.mjs +174 -0
- package/tools/daemon/concierge/intent-router.mjs +401 -0
- package/tools/daemon/concierge/orchestrator.mjs +272 -0
- package/tools/daemon/concierge/response-translator.mjs +462 -0
- package/tools/daemon/config.mjs +377 -0
- package/tools/daemon/cron-scheduler.mjs +178 -0
- package/tools/daemon/daemon-main.mjs +1169 -0
- package/tools/daemon/event-router.mjs +84 -0
- package/tools/daemon/file-watcher.mjs +383 -0
- package/tools/daemon/index.mjs +1181 -0
- package/tools/daemon/init-profile.mjs +124 -0
- package/tools/daemon/ipc-client.mjs +197 -0
- package/tools/daemon/ipc-ops-handlers.mjs +236 -0
- package/tools/daemon/ipc-server.mjs +275 -0
- package/tools/daemon/maintenance-owner.mjs +79 -0
- package/tools/daemon/memory-manager.mjs +386 -0
- package/tools/daemon/message-router.mjs +194 -0
- package/tools/daemon/provider-watcher.mjs +585 -0
- package/tools/daemon/pty-adapter.mjs +420 -0
- package/tools/daemon/repl-chat.mjs +359 -0
- package/tools/daemon/resource-bounds.mjs +88 -0
- package/tools/daemon/sandbox-transport.mjs +295 -0
- package/tools/daemon/scheduled-task-runner.mjs +535 -0
- package/tools/daemon/task-store.mjs +450 -0
- package/tools/daemon/tmux-manager.mjs +324 -0
- package/tools/daemon/update-policy.mjs +517 -0
- package/tools/daemon/web-server.mjs +399 -0
- package/tools/daemon/web-ui/index.html +585 -0
- package/tools/daemon/web-ui/styles.css +156 -0
- package/tools/docker/Dockerfile.daemon +35 -0
- package/tools/docker/container-manager.mjs +291 -0
- package/tools/messaging/adapter-registry.mjs +230 -0
- package/tools/messaging/adapters/base.mjs +326 -0
- package/tools/messaging/adapters/discord.mjs +462 -0
- package/tools/messaging/adapters/slack.mjs +402 -0
- package/tools/messaging/adapters/telegram.mjs +552 -0
- package/tools/messaging/chat-handler.mjs +297 -0
- package/tools/messaging/command-router.mjs +269 -0
- package/tools/messaging/event-bus.mjs +199 -0
- package/tools/messaging/index.mjs +456 -0
- package/tools/messaging/message-formatter.mjs +320 -0
- package/tools/messaging/room-manager.mjs +277 -0
- package/tools/messaging/types.mjs +94 -0
- package/tools/providers/pi-bridge-policy.mjs +4 -0
- package/tools/ralph-external/daemon-supervisor.mjs +394 -0
- package/tools/ralph-external/lib/behavior-registry.mjs +270 -0
- package/tools/ralph-external/lib/worker-invocation-processes.mjs +3 -2
- package/tools/ralph-external/lib/worker-isolation-args.mjs +217 -0
- package/tools/ralph-external/lib/worker-isolation-status.mjs +19 -0
- package/tools/ralph-external/lib/worker-isolation.mjs +11 -237
- package/tools/ralph-external/lib/worker-overflow.mjs +10 -2
- package/tools/ralph-external/lib/worker-unit-cleanup.mjs +72 -0
- package/tools/ralph-external/session-launcher.mjs +7 -7
- package/tools/scripts/resource-preflight.mjs +3 -242
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { promises as fs } from 'node:fs';
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import { load as loadYaml } from 'js-yaml';
|
|
4
|
+
import { getStaticTOMLValue, parseTOML } from 'toml-eslint-parser';
|
|
4
5
|
import { MODEL_WRAPPER_DEFINITIONS } from './wrapper-definitions.js';
|
|
5
6
|
import { isFlagshipModel } from './tiers.js';
|
|
6
7
|
const CLAUDE_ALIASES = {
|
|
@@ -30,19 +31,12 @@ async function collectFiles(root) {
|
|
|
30
31
|
return files.sort();
|
|
31
32
|
}
|
|
32
33
|
function tomlFields(content) {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
try {
|
|
39
|
-
fields[match[1]] = JSON.parse(`"${match[2]}"`);
|
|
40
|
-
}
|
|
41
|
-
catch {
|
|
42
|
-
fields[match[1]] = match[2];
|
|
43
|
-
}
|
|
34
|
+
try {
|
|
35
|
+
return getStaticTOMLValue(parseTOML(content));
|
|
36
|
+
}
|
|
37
|
+
catch {
|
|
38
|
+
return null;
|
|
44
39
|
}
|
|
45
|
-
return fields;
|
|
46
40
|
}
|
|
47
41
|
function markdownFields(content) {
|
|
48
42
|
const match = content.match(/^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/);
|
|
@@ -67,6 +61,25 @@ function artifactFields(file, content) {
|
|
|
67
61
|
return markdownFields(content);
|
|
68
62
|
return null;
|
|
69
63
|
}
|
|
64
|
+
/** Read the same deployed artifacts used by verification, without repairing them. */
|
|
65
|
+
export async function readModelWrapperArtifacts(agentsPath) {
|
|
66
|
+
const artifacts = [];
|
|
67
|
+
if (!agentsPath)
|
|
68
|
+
return artifacts;
|
|
69
|
+
for (const file of await collectFiles(agentsPath)) {
|
|
70
|
+
const name = path.basename(file).replace(/(?:\.agent)?\.(?:md|toml|json|yaml|yml)$/i, '');
|
|
71
|
+
const wrapper = MODEL_WRAPPER_DEFINITIONS.find(item => item.name === name);
|
|
72
|
+
if (!wrapper)
|
|
73
|
+
continue;
|
|
74
|
+
let fields = null;
|
|
75
|
+
try {
|
|
76
|
+
fields = artifactFields(file, await fs.readFile(file, 'utf8'));
|
|
77
|
+
}
|
|
78
|
+
catch { /* unresolved metadata */ }
|
|
79
|
+
artifacts.push({ wrapper, file, fields });
|
|
80
|
+
}
|
|
81
|
+
return artifacts;
|
|
82
|
+
}
|
|
70
83
|
function fieldValue(fields, ...names) {
|
|
71
84
|
for (const name of names) {
|
|
72
85
|
const value = fields[name];
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
// Describes controls on deployed wrapper artifacts, distinct from headless CLI controls.
|
|
2
2
|
import { compileModelPolicy, loadProviderModelCatalog } from './catalog-policy.js';
|
|
3
3
|
import { MODEL_WRAPPER_DEFINITIONS } from './wrapper-definitions.js';
|
|
4
|
+
import { flagshipElected, isFlagshipModel } from './tiers.js';
|
|
5
|
+
import { loadProviderModelCapabilities } from './provider-policy.js';
|
|
4
6
|
const NATIVE_CONTROLS = {
|
|
5
7
|
claude: { model: 'model', effort: 'effort' },
|
|
6
8
|
codex: { model: 'model', effort: 'model_reasoning_effort' },
|
|
@@ -8,12 +10,49 @@ const NATIVE_CONTROLS = {
|
|
|
8
10
|
factory: { model: 'model', effort: 'reasoningEffort' },
|
|
9
11
|
opencode: { model: 'model' }, omp: { model: 'model', effort: 'thinkingLevel' },
|
|
10
12
|
};
|
|
13
|
+
export const GLOBAL_WRAPPER_SETTINGS = {
|
|
14
|
+
hermes: 'Hermes config.yaml: delegation.model / delegation.effort',
|
|
15
|
+
warp: 'Warp agent run --model <MODEL_ID> (run/profile-wide); effort: unavailable',
|
|
16
|
+
muse: 'Muse --model / --reasoning-effort; $XDG_CONFIG_HOME/muse/settings.json model supplies the model fallback',
|
|
17
|
+
grokbot: 'Grok Bot model: unavailable; effort: unavailable (no verified native setting in the provider catalog)',
|
|
18
|
+
};
|
|
11
19
|
const GLOBAL_ONLY = new Set(['warp', 'hermes', 'grokbot', 'muse']);
|
|
12
20
|
export function wrapperControls(provider) {
|
|
13
21
|
return NATIVE_CONTROLS[provider] ?? {};
|
|
14
22
|
}
|
|
15
23
|
export function isConcreteWrapperModel(model) {
|
|
16
|
-
return Boolean(model && !/^(?:configured\/|Hint\(|auto$|inherit(?:ed)?$|default$|profile-selected$|global-delegation-model$)
|
|
24
|
+
return Boolean(model?.trim() && !/^(?:configured\/|Hint\(|auto$|inherit(?:ed)?$|default$|profile-selected$|global-delegation-model$|unknown$|unresolved$|placeholder$|todo$)|\$\{|<[^>]+>/i.test(model.trim()));
|
|
25
|
+
}
|
|
26
|
+
/** Observed artifact controls, never a claim about an active provider session. */
|
|
27
|
+
export function deployedWrapperEnforcement(provider, artifact) {
|
|
28
|
+
const controls = wrapperControls(provider);
|
|
29
|
+
const globalOnly = GLOBAL_ONLY.has(provider);
|
|
30
|
+
const pinned = Boolean(controls.model && isConcreteWrapperModel(artifact.model) && !artifact.forceInheritedModel);
|
|
31
|
+
const model = globalOnly ? 'global-only' : pinned ? 'pinned' : 'inherited';
|
|
32
|
+
const effort = globalOnly ? 'global-only'
|
|
33
|
+
: controls.effort && artifact.effort && loadProviderModelCapabilities().providers[provider]?.effortValues?.includes(artifact.effort) ? 'pinned' : 'inherited';
|
|
34
|
+
return { model, effort, effectiveModel: pinned ? artifact.model : artifact.inheritedModel,
|
|
35
|
+
effectiveEffort: effort === 'pinned' ? artifact.effort : artifact.inheritedEffort };
|
|
36
|
+
}
|
|
37
|
+
export function wrapperModelRisks(provider, artifact, catalog = loadProviderModelCatalog()) {
|
|
38
|
+
const state = deployedWrapperEnforcement(provider, artifact);
|
|
39
|
+
const findings = [];
|
|
40
|
+
if ((artifact.model !== undefined && !isConcreteWrapperModel(artifact.model))
|
|
41
|
+
|| !isConcreteWrapperModel(state.effectiveModel))
|
|
42
|
+
findings.push('delegation.unresolved-model');
|
|
43
|
+
const matches = (ids) => ids.filter(isConcreteWrapperModel)
|
|
44
|
+
.some(id => state.effectiveModel === id || state.effectiveModel?.endsWith(`/${id}`));
|
|
45
|
+
const flagship = !!state.effectiveModel && (isFlagshipModel(state.effectiveModel)
|
|
46
|
+
|| Object.values(catalog.providers).some(entry => matches([entry?.tiers?.flagship?.id])));
|
|
47
|
+
const premium = !!state.effectiveModel && (Object.values(catalog.providers)
|
|
48
|
+
.some(entry => matches([entry?.tiers?.premium?.id, entry?.roles.reasoning.id]))
|
|
49
|
+
|| (provider === 'claude' && state.effectiveModel === 'opus'));
|
|
50
|
+
// Flagship always needs an operator election, pinned or not. Premium is a normal ladder tier
|
|
51
|
+
// (the reasoning role's default), so it is a risk only when a wrapper inherits it.
|
|
52
|
+
if ((flagship || (premium && state.model !== 'pinned')) && !flagshipElected(artifact)) {
|
|
53
|
+
findings.push('delegation.flagship-inheritance');
|
|
54
|
+
}
|
|
55
|
+
return findings;
|
|
17
56
|
}
|
|
18
57
|
export function resolveWrapperPin(provider, wrapper, options = {}) {
|
|
19
58
|
const controls = wrapperControls(provider);
|
|
@@ -41,14 +80,15 @@ export function resolveWrapperPin(provider, wrapper, options = {}) {
|
|
|
41
80
|
enforcement: (GLOBAL_ONLY.has(provider) ? 'global-only' : model ? 'pinned' : 'inherited') };
|
|
42
81
|
}
|
|
43
82
|
/** Static artifact defaults; this does not inspect live sessions or assert runtime enforcement. */
|
|
44
|
-
export function wrapperEnforcementReport(provider) {
|
|
83
|
+
export function wrapperEnforcementReport(provider, artifact) {
|
|
45
84
|
const catalog = loadProviderModelCatalog();
|
|
46
85
|
const controls = wrapperControls(provider);
|
|
47
86
|
const known = provider in catalog.providers;
|
|
48
87
|
const states = known ? MODEL_WRAPPER_DEFINITIONS.map(wrapper => resolveWrapperPin(provider, wrapper, { catalog }).enforcement) : [];
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
-
|
|
88
|
+
const observed = artifact ? deployedWrapperEnforcement(provider, artifact) : undefined;
|
|
89
|
+
const state = observed?.model ?? (GLOBAL_ONLY.has(provider) ? 'global-only'
|
|
90
|
+
: states.length > 0 && states.every(value => value === 'pinned') ? 'pinned' : 'inherited');
|
|
91
|
+
const effort = observed ? `${observed.effort}${observed.effort === 'pinned' ? ` via ${controls.effort}` : ''}` : state === 'pinned' && controls.effort
|
|
52
92
|
? `pinned via ${controls.effort} (high/medium/low by wrapper)` : 'not enforced per wrapper';
|
|
53
93
|
const details = {
|
|
54
94
|
claude: 'Use AIWG wrappers or an explicit invocation model. Unpinned general-purpose agents inherit; CLAUDE_CODE_SUBAGENT_MODEL supplies a fallback and CLAUDE_CODE_SUBAGENT_MODEL_FORCE=1 can override pins.',
|
|
@@ -65,8 +105,8 @@ export function wrapperEnforcementReport(provider) {
|
|
|
65
105
|
grokbot: 'No verified AIWG-owned per-worker model setting is available.',
|
|
66
106
|
muse: 'Session --model or settings.json model controls selection; per-agent pins are unverified.',
|
|
67
107
|
};
|
|
68
|
-
return `Tier enforcement (generated wrapper defaults): ${state}; effort: ${effort}. `
|
|
69
|
-
+ `${details[provider] ?? (known ? 'Native custom subagents carry explicit catalog model selectors.' : 'Provider wrapper controls are unverified.')} `
|
|
108
|
+
return `Tier enforcement (${artifact ? 'deployed wrapper' : 'generated wrapper defaults'}): ${state}; effort: ${effort}. `
|
|
109
|
+
+ `${GLOBAL_WRAPPER_SETTINGS[provider] ? `${GLOBAL_WRAPPER_SETTINGS[provider]}. ` : ''}${details[provider] ?? (known ? 'Native custom subagents carry explicit catalog model selectors.' : 'Provider wrapper controls are unverified.')} `
|
|
70
110
|
+ 'Explicit operator pins are preserved where supported. This is not a live resolved-model audit; provider/account policy may substitute models.';
|
|
71
111
|
}
|
|
72
112
|
//# sourceMappingURL=wrapper-enforcement.js.map
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { isRefId } from '../research/identity.js';
|
|
1
2
|
import { formatEvidenceCitation, validateEvidenceReferences } from './citations.js';
|
|
2
3
|
import { assertLocalOutputAllowed } from './governance.js';
|
|
3
4
|
export const RESEARCH_PACKET_SOURCE_SCHEMA = 'aiwg.research.packet-evidence-source.v1';
|
|
@@ -145,7 +146,7 @@ function frameForStream(citations) {
|
|
|
145
146
|
return frame?.locator.type === 'frame' ? frame.locator.frame_number : null;
|
|
146
147
|
}
|
|
147
148
|
function validateResearchInput(input) {
|
|
148
|
-
if (
|
|
149
|
+
if (!isRefId(input.refId))
|
|
149
150
|
throw new Error('Packet evidence research source requires a REF-NNN identifier');
|
|
150
151
|
requiredString(input.title, 'Research source title');
|
|
151
152
|
if (input.evidence.kind !== 'PacketEvidenceBundle' || input.evidence.status === 'error') {
|
|
@@ -4,6 +4,7 @@ import { basename, dirname, isAbsolute, relative, resolve } from 'node:path';
|
|
|
4
4
|
import { effectSession, openLedger } from '../effects/host.js';
|
|
5
5
|
import { loadHitlLayers } from './hitl-config.js';
|
|
6
6
|
import { recordHitlAuthorization } from './hitl-receipt.js';
|
|
7
|
+
import { consumeHitlAuthorization } from './hitl-consume.js';
|
|
7
8
|
import { resolveHitlAuthorization, validHitlAction } from './hitl.js';
|
|
8
9
|
/** Resolve existing ancestors as well as new leaves; dangling links fail closed. */
|
|
9
10
|
async function canonical(path) {
|
|
@@ -54,24 +55,33 @@ export async function canonicalHitlAction(projectDir, input) {
|
|
|
54
55
|
}
|
|
55
56
|
/** No receipt, no automatic action. Errors retain the caller's existing review path. */
|
|
56
57
|
export async function checkHitlAuthorization(projectDir, input, options = {}) {
|
|
57
|
-
let context = { now: new Date().toISOString(), layers: []
|
|
58
|
+
let context = { ...options, now: options.now ?? new Date().toISOString(), layers: [] };
|
|
58
59
|
try {
|
|
59
60
|
const loaded = await loadHitlLayers(projectDir);
|
|
60
61
|
context = { ...context, layers: loaded.layers };
|
|
61
62
|
const action = await canonicalHitlAction(loaded.projectDir, input);
|
|
63
|
+
if (options.receipt) {
|
|
64
|
+
const ledger = openLedger(await effectSession(loaded.projectDir, 'custom', { clock: () => Date.parse(context.now) }));
|
|
65
|
+
const consumed = await consumeHitlAuthorization(ledger, action, context, options.receipt);
|
|
66
|
+
return consumed.decision === 'auto-authorized' ? { ...consumed, receipt: options.receipt } : consumed;
|
|
67
|
+
}
|
|
62
68
|
const decision = resolveHitlAuthorization(action, context);
|
|
63
69
|
if (decision.decision !== 'auto-authorized')
|
|
64
70
|
return decision;
|
|
65
71
|
// Reload policies and the clock at consumption time, including expiry and revocation.
|
|
66
|
-
context = { ...context, now: new Date().toISOString(), layers: (await loadHitlLayers(projectDir)).layers,
|
|
72
|
+
context = { ...context, now: options.now ?? new Date().toISOString(), layers: (await loadHitlLayers(projectDir)).layers,
|
|
67
73
|
expectedPolicyVersion: options.expectedPolicyVersion ?? decision.policyVersion };
|
|
68
|
-
const ledger = openLedger(await effectSession(loaded.projectDir, 'custom'));
|
|
74
|
+
const ledger = openLedger(await effectSession(loaded.projectDir, 'custom', { clock: () => Date.parse(context.now) }));
|
|
69
75
|
const recorded = await recordHitlAuthorization(ledger, action, context);
|
|
70
76
|
if (recorded.resolution.decision !== 'auto-authorized')
|
|
71
77
|
return recorded.resolution;
|
|
72
78
|
if (recorded.reconciled.result.verification.result !== 'present')
|
|
73
79
|
throw new Error('Unverified HITL receipt');
|
|
74
|
-
|
|
80
|
+
const receipt = { file: recorded.file, effectId: recorded.intent.effectId };
|
|
81
|
+
context = { ...context, now: options.now ?? new Date().toISOString(), layers: (await loadHitlLayers(projectDir)).layers,
|
|
82
|
+
expectedPolicyVersion: options.expectedPolicyVersion };
|
|
83
|
+
const consumed = await consumeHitlAuthorization(ledger, action, context, receipt);
|
|
84
|
+
return consumed.decision === 'auto-authorized' ? { ...consumed, receipt } : consumed;
|
|
75
85
|
}
|
|
76
86
|
catch {
|
|
77
87
|
return { ...resolveHitlAuthorization(null, context), decision: 'escalate', reason: 'authorization-check-unavailable' };
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
// Verifies a persisted HITL receipt against the exact host effect and current authority.
|
|
2
|
+
import { readFile } from 'node:fs/promises';
|
|
3
|
+
import { resolve } from 'node:path';
|
|
4
|
+
import { resolveProjectAiwgDirForWrite } from '../config/project-artifacts.js';
|
|
5
|
+
import { lookupEffect } from '../effects/ledger.js';
|
|
6
|
+
import { payloadDigest } from '../effects/identity.js';
|
|
7
|
+
import { fileDigestVerifier } from '../effects/verifiers/file.js';
|
|
8
|
+
import { runVerifier } from '../effects/verifiers/registry.js';
|
|
9
|
+
import { hitlDigest, resolveHitlAuthorization, validHitlAction } from './hitl.js';
|
|
10
|
+
/** Receipt existence is historical evidence; only this fresh comparison authorizes dispatch. */
|
|
11
|
+
export async function consumeHitlAuthorization(ledger, action, context, reference) {
|
|
12
|
+
const resolution = resolveHitlAuthorization(action, context);
|
|
13
|
+
const refuse = (reason) => ({ ...resolution, decision: 'escalate', reason });
|
|
14
|
+
if (!validHitlAction(action))
|
|
15
|
+
return refuse('invalid-action-descriptor');
|
|
16
|
+
const effect = await lookupEffect(ledger, reference.effectId);
|
|
17
|
+
const intent = effect.records.find(record => record.phase === 'intent');
|
|
18
|
+
if (effect.kind !== 'file.digest' || effect.tombstoned || effect.result !== 'present' || !intent
|
|
19
|
+
|| effect.target !== `file:${resolve(reference.file)}@${intent.payloadDigest}`)
|
|
20
|
+
return refuse('approval-unverified');
|
|
21
|
+
const verification = await runVerifier(fileDigestVerifier({ root: resolveProjectAiwgDirForWrite(ledger.projectDir) }), {
|
|
22
|
+
effectId: reference.effectId, scope: ledger.scope, kind: effect.kind, target: effect.target,
|
|
23
|
+
context: {}, payloadDigest: intent.payloadDigest, intentRecordedAt: intent.recordedAt, expected: { digest: intent.payloadDigest },
|
|
24
|
+
});
|
|
25
|
+
if (verification.observation.result !== 'present')
|
|
26
|
+
return refuse('approval-unverified');
|
|
27
|
+
const bytes = await readFile(reference.file, 'utf8');
|
|
28
|
+
if (payloadDigest(bytes) !== intent.payloadDigest)
|
|
29
|
+
return refuse('approval-unverified');
|
|
30
|
+
const receipt = JSON.parse(bytes);
|
|
31
|
+
if (receipt.kind !== 'hitl-authorization' || receipt.decision !== 'auto-authorized')
|
|
32
|
+
return refuse('approval-not-authorized');
|
|
33
|
+
if (action.category === 'repo.edit' && (!receipt.action?.actorDigest || !receipt.action?.inputDigest || !receipt.expiresAt)) {
|
|
34
|
+
return refuse('approval-missing-bindings');
|
|
35
|
+
}
|
|
36
|
+
if (receipt.action?.actorDigest !== (action.actor === undefined ? undefined : hitlDigest(action.actor)))
|
|
37
|
+
return refuse('approval-actor-mismatch');
|
|
38
|
+
if (receipt.action?.inputDigest !== action.inputDigest)
|
|
39
|
+
return refuse('approval-input-mismatch');
|
|
40
|
+
if (receipt.action?.descriptorDigest !== hitlDigest(action))
|
|
41
|
+
return refuse('approval-descriptor-mismatch');
|
|
42
|
+
const now = Date.parse(context.now);
|
|
43
|
+
if (!Number.isFinite(now))
|
|
44
|
+
return refuse('invalid-clock');
|
|
45
|
+
if (!Number.isFinite(Date.parse(receipt.expiresAt)) || now >= Date.parse(receipt.expiresAt))
|
|
46
|
+
return refuse('approval-expired');
|
|
47
|
+
if (resolution.decision !== 'auto-authorized')
|
|
48
|
+
return resolution;
|
|
49
|
+
if (receipt.policyVersion !== resolution.policyVersion || receipt.sessionGrantDigest !== hitlDigest(context.sessionAuthorization ?? null)) {
|
|
50
|
+
return refuse('stale-policy-version');
|
|
51
|
+
}
|
|
52
|
+
return resolution;
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=hitl-consume.js.map
|
|
@@ -20,6 +20,8 @@ export async function recordHitlAuthorization(ledger, action, context) {
|
|
|
20
20
|
action: validHitlAction(action) ? {
|
|
21
21
|
category: HITL_CATEGORIES.find(category => category === action.category) ?? 'restricted',
|
|
22
22
|
descriptorDigest: hitlDigest(action), categoryDigest: hitlDigest(action.category),
|
|
23
|
+
...(action.actor === undefined ? {} : { actorDigest: hitlDigest(action.actor) }),
|
|
24
|
+
...(action.inputDigest === undefined ? {} : { inputDigest: action.inputDigest }),
|
|
23
25
|
reversible: action.reversible, impact: action.impact,
|
|
24
26
|
} : { descriptorDigest: hitlDigest(action) },
|
|
25
27
|
scope: validHitlAction(action) ? {
|
package/dist/src/policy/hitl.js
CHANGED
|
@@ -19,7 +19,11 @@ export function validHitlAction(value) {
|
|
|
19
19
|
}
|
|
20
20
|
function actionFieldsValid(a) {
|
|
21
21
|
const keys = ['category', 'repo', 'environment', 'resources', 'reversible', 'impact'];
|
|
22
|
-
|
|
22
|
+
const binding = ['actor', 'inputDigest'];
|
|
23
|
+
return Object.keys(a).every(k => [...keys, ...binding].includes(k)) && keys.every(k => Object.hasOwn(a, k))
|
|
24
|
+
&& (a.category !== 'repo.edit' || (binding.every(k => Object.hasOwn(a, k)) && typeof a.actor === 'string' && typeof a.inputDigest === 'string'))
|
|
25
|
+
&& (a.actor === undefined || (typeof a.actor === 'string' && identifier.test(a.actor)))
|
|
26
|
+
&& (a.inputDigest === undefined || (typeof a.inputDigest === 'string' && /^sha256:[a-f0-9]{64}$/.test(a.inputDigest)))
|
|
23
27
|
&& [a.category, a.repo, a.environment].every(x => typeof x === 'string' && identifier.test(x))
|
|
24
28
|
&& Array.isArray(a.resources) && a.resources.length > 0 && a.resources.every(p => typeof p === 'string' && pathValid(p))
|
|
25
29
|
&& typeof a.reversible === 'boolean' && ['low', 'medium', 'high'].includes(a.impact);
|
|
@@ -89,13 +93,16 @@ export function resolveHitlAuthorization(action, context) {
|
|
|
89
93
|
const probe = { version: '1', enabled: true, reviewedAt: context.now, maxAgeSeconds: 1,
|
|
90
94
|
expiresAt: session.profile.expiresAt, profiles: { session: session.profile }, deny: [], requireReview: [] };
|
|
91
95
|
if (!validateHitlPolicy(probe).length && grant(session.profile, action, now))
|
|
92
|
-
return
|
|
96
|
+
return {
|
|
97
|
+
...result('auto-authorized', 'session-user-authorization', 'session-user', 'session'), expiresAt: session.profile.expiresAt,
|
|
98
|
+
};
|
|
93
99
|
}
|
|
94
100
|
if (context.expectedPolicyVersion && policyVersion !== context.expectedPolicyVersion)
|
|
95
101
|
return result('escalate', 'stale-policy-version', 'project-policy');
|
|
96
102
|
if (!context.layers.length)
|
|
97
103
|
return result('escalate', 'no-project-policy', 'default');
|
|
98
104
|
let matched = null;
|
|
105
|
+
let expires = Infinity;
|
|
99
106
|
for (const layer of context.layers) {
|
|
100
107
|
const p = layer.policy;
|
|
101
108
|
if (!p?.enabled)
|
|
@@ -111,7 +118,8 @@ export function resolveHitlAuthorization(action, context) {
|
|
|
111
118
|
if (!entry)
|
|
112
119
|
return result('escalate', 'outside-profile-or-expired', 'project-policy');
|
|
113
120
|
matched = entry[0];
|
|
121
|
+
expires = Math.min(expires, Date.parse(p.expiresAt), reviewed + p.maxAgeSeconds * 1000, Date.parse(entry[1].expiresAt));
|
|
114
122
|
}
|
|
115
|
-
return result('auto-authorized', 'bounded-project-policy', 'project-policy', matched);
|
|
123
|
+
return { ...result('auto-authorized', 'bounded-project-policy', 'project-policy', matched), expiresAt: new Date(expires).toISOString() };
|
|
116
124
|
}
|
|
117
125
|
//# sourceMappingURL=hitl.js.map
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
const VERIFIED_ON = '2026-07-21';
|
|
2
|
+
export const CONTEXT_CONTRACTS = {
|
|
3
|
+
antigravity: {
|
|
4
|
+
startupFiles: ['AGENTS.md', 'GEMINI.md'],
|
|
5
|
+
precedence: ['provider/system', 'project AGENTS.md or GEMINI.md', 'nested project context when selected by the CLI'],
|
|
6
|
+
loadMode: 'prose-directive', includeSyntax: null, configRegistration: null,
|
|
7
|
+
bootstrapTargets: ['AGENTS.md'], maxContextBytes: null, recommendedMaxLines: null, nestedContext: true, support: 'supported',
|
|
8
|
+
verification: {
|
|
9
|
+
method: 'official Antigravity CLI documentation and sanitized 1.1.26 help evidence',
|
|
10
|
+
source: 'https://antigravity.google/docs/cli/overview/',
|
|
11
|
+
lastVerified: '2026-09-04',
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
claude: {
|
|
15
|
+
startupFiles: ['CLAUDE.md', '.claude/CLAUDE.md'], precedence: ['provider/system', 'nested CLAUDE.md', 'root CLAUDE.md'],
|
|
16
|
+
loadMode: 'native-include', includeSyntax: '@WORKSPACE.md\n@AIWG.md', configRegistration: null,
|
|
17
|
+
bootstrapTargets: ['CLAUDE.md'], maxContextBytes: null, recommendedMaxLines: 200, nestedContext: true, support: 'supported',
|
|
18
|
+
verification: { method: 'official documentation: CLAUDE.md imports and InstructionsLoaded hook', source: 'https://code.claude.com/docs/en/memory', lastVerified: VERIFIED_ON },
|
|
19
|
+
},
|
|
20
|
+
codex: {
|
|
21
|
+
startupFiles: ['AGENTS.override.md', 'AGENTS.md'], precedence: ['provider/system', 'root-to-cwd AGENTS chain', 'nearest file'],
|
|
22
|
+
loadMode: 'prose-directive', includeSyntax: null, configRegistration: null,
|
|
23
|
+
bootstrapTargets: ['AGENTS.md'], maxContextBytes: 32 * 1024, recommendedMaxLines: null, nestedContext: true, support: 'supported',
|
|
24
|
+
verification: { method: 'official AGENTS.md discovery chain; no Markdown include claimed', source: 'https://developers.openai.com/codex/guides/agents-md', lastVerified: VERIFIED_ON },
|
|
25
|
+
},
|
|
26
|
+
copilot: {
|
|
27
|
+
startupFiles: ['.github/copilot-instructions.md', 'AGENTS.md', 'CLAUDE.md'], precedence: ['personal', 'repository', 'organization; CLI combines applicable files'],
|
|
28
|
+
loadMode: 'native-include', includeSyntax: '@WORKSPACE.md\n@AIWG.md', configRegistration: null,
|
|
29
|
+
bootstrapTargets: ['.github/copilot-instructions.md', 'AGENTS.md'], maxContextBytes: null, recommendedMaxLines: null, nestedContext: true, support: 'supported',
|
|
30
|
+
verification: { method: 'official Copilot CLI custom-instruction imports', source: 'https://docs.github.com/en/copilot/how-tos/copilot-cli/customize-copilot/add-custom-instructions', lastVerified: VERIFIED_ON },
|
|
31
|
+
},
|
|
32
|
+
cursor: {
|
|
33
|
+
startupFiles: ['AGENTS.md', 'CLAUDE.md', '.cursor/rules/*.mdc'], precedence: ['provider/system', 'project rules', 'root AGENTS.md'],
|
|
34
|
+
loadMode: 'prose-directive', includeSyntax: null, configRegistration: null,
|
|
35
|
+
bootstrapTargets: ['AGENTS.md'], maxContextBytes: null, recommendedMaxLines: 500, nestedContext: false, support: 'supported',
|
|
36
|
+
verification: { method: 'official Cursor rules and CLI documentation', source: 'https://docs.cursor.com/context/rules-for-ai', lastVerified: VERIFIED_ON },
|
|
37
|
+
},
|
|
38
|
+
'deepseek-harness': {
|
|
39
|
+
startupFiles: ['AGENTS.md', 'CLAUDE.md'],
|
|
40
|
+
precedence: ['provider/system', 'project AGENTS.md or CLAUDE.md', 'nested project context'],
|
|
41
|
+
loadMode: 'prose-directive', includeSyntax: null, configRegistration: null,
|
|
42
|
+
bootstrapTargets: ['AGENTS.md'], maxContextBytes: 65536, recommendedMaxLines: null, nestedContext: true, support: 'supported',
|
|
43
|
+
verification: {
|
|
44
|
+
method: 'DeepSeek Harness instruction and filesystem-skill source review',
|
|
45
|
+
source: 'https://github.com/deepseek-ai/deepseek-harness',
|
|
46
|
+
lastVerified: '2026-09-05',
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
factory: {
|
|
50
|
+
startupFiles: ['AGENTS.md', '~/.factory/AGENTS.md'], precedence: ['provider/system', 'nearest AGENTS.md', 'root AGENTS.md', 'personal override'],
|
|
51
|
+
loadMode: 'prose-directive', includeSyntax: null, configRegistration: null,
|
|
52
|
+
bootstrapTargets: ['AGENTS.md'], maxContextBytes: null, recommendedMaxLines: 150, nestedContext: true, support: 'supported',
|
|
53
|
+
verification: { method: 'official Factory AGENTS.md discovery hierarchy', source: 'https://docs.factory.ai/cli/configuration/agents-md', lastVerified: VERIFIED_ON },
|
|
54
|
+
},
|
|
55
|
+
grokbot: {
|
|
56
|
+
startupFiles: ['AGENTS.md'],
|
|
57
|
+
precedence: ['provider/system', 'project AGENTS.md when the host exposes it', 'explicit aiwg discover/show'],
|
|
58
|
+
loadMode: 'prose-directive', includeSyntax: null, configRegistration: null,
|
|
59
|
+
bootstrapTargets: ['AGENTS.md'], maxContextBytes: null, recommendedMaxLines: null, nestedContext: false, support: 'degraded',
|
|
60
|
+
verification: {
|
|
61
|
+
method: 'AIWG discover-first adapter contract; native Grok Bot startup/include path not yet verified — explicit-read guidance only',
|
|
62
|
+
source: 'docs/architecture/adr-grokbot-provider-target.md',
|
|
63
|
+
lastVerified: '2026-09-15',
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
'grok-build': {
|
|
67
|
+
// config.toml is configuration (MCP/plugins/permissions), not a startup/context file.
|
|
68
|
+
// Hierarchical instructions: AGENTS.md + .grok/rules/*.md, root-to-cwd, deeper wins.
|
|
69
|
+
startupFiles: ['AGENTS.md', '.grok/rules/*.md'],
|
|
70
|
+
precedence: [
|
|
71
|
+
'provider/system',
|
|
72
|
+
'global ~/.grok instruction sources',
|
|
73
|
+
'root-to-cwd AGENTS.md and .grok/rules/*.md (deeper files win on conflicts)',
|
|
74
|
+
'$GROK_HOME for user skills and user config',
|
|
75
|
+
],
|
|
76
|
+
loadMode: 'prose-directive', includeSyntax: null, configRegistration: null,
|
|
77
|
+
bootstrapTargets: ['AGENTS.md'], maxContextBytes: null, recommendedMaxLines: null, nestedContext: true, support: 'supported',
|
|
78
|
+
verification: {
|
|
79
|
+
method: 'xAI project-rules docs (AGENTS.md + .grok/rules hierarchical discovery); grok inspect when installed',
|
|
80
|
+
source: 'https://docs.x.ai/build/features/project-rules',
|
|
81
|
+
lastVerified: '2026-09-20',
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
hermes: {
|
|
85
|
+
startupFiles: ['.hermes.md', 'AGENTS.md'], precedence: ['provider/system', '.hermes.md', 'AGENTS.md'],
|
|
86
|
+
loadMode: 'prose-directive', includeSyntax: null, configRegistration: null,
|
|
87
|
+
bootstrapTargets: ['.hermes.md', 'AGENTS.md'], maxContextBytes: null, recommendedMaxLines: 30, nestedContext: false, support: 'degraded',
|
|
88
|
+
verification: { method: 'AIWG Hermes adapter contract; on-demand artifact-read required', source: 'agentic/code/providers/capability-matrix.yaml', lastVerified: VERIFIED_ON },
|
|
89
|
+
},
|
|
90
|
+
// #225: Muse Code prefers AGENTS.md over CLAUDE.md at each directory level;
|
|
91
|
+
// project AGENTS.md loads only after the workspace is explicitly trusted
|
|
92
|
+
// (first-run trust prompt). AIWG deploys a discover-first AGENTS.md bridge.
|
|
93
|
+
muse: {
|
|
94
|
+
startupFiles: ['AGENTS.md'],
|
|
95
|
+
precedence: ['provider/system', 'project AGENTS.md once the workspace is trusted', 'explicit aiwg discover/show'],
|
|
96
|
+
loadMode: 'prose-directive', includeSyntax: null, configRegistration: null,
|
|
97
|
+
bootstrapTargets: ['AGENTS.md'], maxContextBytes: null, recommendedMaxLines: null, nestedContext: false, support: 'supported',
|
|
98
|
+
verification: {
|
|
99
|
+
method: 'ADR-locked surfaces; discover-first AGENTS.md bridge per official Muse Code docs (trust-gated load)',
|
|
100
|
+
source: 'docs/architecture/adr-muse-provider-target.md',
|
|
101
|
+
lastVerified: '2026-09-24',
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
opencode: {
|
|
105
|
+
startupFiles: ['AGENTS.md', 'CLAUDE.md', 'opencode.json#instructions'], precedence: ['provider/system', 'nearest AGENTS.md', 'CLAUDE compatibility', 'registered instructions'],
|
|
106
|
+
loadMode: 'config-registration', includeSyntax: null, configRegistration: { file: 'opencode.json', key: 'instructions' },
|
|
107
|
+
bootstrapTargets: ['AGENTS.md'], maxContextBytes: null, recommendedMaxLines: null, nestedContext: true, support: 'supported',
|
|
108
|
+
verification: { method: 'official OpenCode rules documentation and instructions array', source: 'https://opencode.ai/docs/rules/', lastVerified: VERIFIED_ON },
|
|
109
|
+
},
|
|
110
|
+
openclaw: {
|
|
111
|
+
startupFiles: ['~/.openclaw/config.yaml'], precedence: ['provider/system', 'home configuration'],
|
|
112
|
+
loadMode: 'unsupported', includeSyntax: null, configRegistration: null,
|
|
113
|
+
bootstrapTargets: [], maxContextBytes: null, recommendedMaxLines: null, nestedContext: false, support: 'degraded',
|
|
114
|
+
verification: { method: 'AIWG home-scope adapter contract; no verified project startup file', source: 'agentic/code/providers/capability-matrix.yaml', lastVerified: VERIFIED_ON },
|
|
115
|
+
},
|
|
116
|
+
openhuman: {
|
|
117
|
+
startupFiles: ['AGENTS.md'], precedence: ['provider/system', 'project AGENTS.md when host exposes it'],
|
|
118
|
+
loadMode: 'prose-directive', includeSyntax: null, configRegistration: null,
|
|
119
|
+
bootstrapTargets: ['AGENTS.md'], maxContextBytes: null, recommendedMaxLines: null, nestedContext: false, support: 'degraded',
|
|
120
|
+
verification: { method: 'AIWG mixed-scope adapter contract; host loading remains capability-dependent', source: 'agentic/code/providers/capability-matrix.yaml', lastVerified: VERIFIED_ON },
|
|
121
|
+
},
|
|
122
|
+
omp: {
|
|
123
|
+
startupFiles: ['.omp/AGENTS.md', 'AGENTS.md'],
|
|
124
|
+
precedence: ['provider/system', 'native nearest nonempty .omp', 'compatibility context ordered by depth; exact paragraph deduplication'],
|
|
125
|
+
loadMode: 'native-include', includeSyntax: '@<relative-path>', configRegistration: null,
|
|
126
|
+
bootstrapTargets: ['.omp/AGENTS.md'], maxContextBytes: null, recommendedMaxLines: null, nestedContext: true, support: 'supported',
|
|
127
|
+
verification: {
|
|
128
|
+
method: 'OMP 18.1.10 source and live context import smoke',
|
|
129
|
+
source: 'https://github.com/can1357/oh-my-pi/blob/5964a0f7649275bcde818f20073193fd032451f2/packages/coding-agent/src/system-prompt.ts#L451',
|
|
130
|
+
lastVerified: '2026-09-04',
|
|
131
|
+
},
|
|
132
|
+
},
|
|
133
|
+
pi: {
|
|
134
|
+
startupFiles: ['AGENTS.override.md', 'AGENTS.md', 'CLAUDE.md'],
|
|
135
|
+
precedence: ['provider/system', 'root-to-cwd context chain', 'AGENTS.override.md supersedes same-directory AGENTS.md and CLAUDE.md'],
|
|
136
|
+
loadMode: 'prose-directive', includeSyntax: null, configRegistration: null,
|
|
137
|
+
bootstrapTargets: ['AGENTS.md'], maxContextBytes: null, recommendedMaxLines: null, nestedContext: true, support: 'supported',
|
|
138
|
+
verification: {
|
|
139
|
+
method: 'Pi coding-agent resource loader and official README context-file documentation',
|
|
140
|
+
source: 'https://github.com/earendil-works/pi/blob/79680533c6b898894f2d2421c7f640b212d3dfdd/packages/coding-agent/README.md#context-files',
|
|
141
|
+
lastVerified: '2026-09-03',
|
|
142
|
+
},
|
|
143
|
+
},
|
|
144
|
+
warp: {
|
|
145
|
+
startupFiles: ['WARP.md', 'AGENTS.md'], precedence: ['provider/system', 'subdirectory rule', 'root rule', 'global rule'],
|
|
146
|
+
loadMode: 'prose-directive', includeSyntax: null, configRegistration: null,
|
|
147
|
+
bootstrapTargets: ['WARP.md', 'AGENTS.md'], maxContextBytes: null, recommendedMaxLines: null, nestedContext: true, support: 'supported',
|
|
148
|
+
verification: { method: 'official Warp project rules documentation', source: 'https://docs.warp.dev/agent-platform/capabilities/rules/', lastVerified: VERIFIED_ON },
|
|
149
|
+
},
|
|
150
|
+
windsurf: {
|
|
151
|
+
startupFiles: ['AGENTS.md', '.windsurf/rules/*.md', '.devin/rules/*.md'], precedence: ['provider/system', 'Devin rules', 'Windsurf rules', 'AGENTS.md'],
|
|
152
|
+
loadMode: 'prose-directive', includeSyntax: null, configRegistration: null,
|
|
153
|
+
bootstrapTargets: ['AGENTS.md'], maxContextBytes: null, recommendedMaxLines: null, nestedContext: true, support: 'degraded',
|
|
154
|
+
verification: { method: 'AIWG Windsurf/Devin topology contract; provider-native rules retained', source: 'src/providers/provider-definitions.ts', lastVerified: VERIFIED_ON },
|
|
155
|
+
},
|
|
156
|
+
generic: {
|
|
157
|
+
startupFiles: [], precedence: ['host policy'], loadMode: 'unsupported', includeSyntax: null, configRegistration: null,
|
|
158
|
+
bootstrapTargets: [], maxContextBytes: null, recommendedMaxLines: null, nestedContext: false, support: 'unsupported',
|
|
159
|
+
verification: { method: 'No provider selected; no startup-file claim', source: 'src/providers/provider-definitions.ts', lastVerified: VERIFIED_ON },
|
|
160
|
+
},
|
|
161
|
+
};
|
|
162
|
+
//# sourceMappingURL=provider-context-contracts.js.map
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
// Provider definition types and runtime validation for the shared registry.
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { integer, url } from '../schema/zod-validation.mjs';
|
|
4
|
+
const ArtifactPathsSchema = z.object({
|
|
5
|
+
agents: z.string().nullable(),
|
|
6
|
+
commands: z.string().nullable(),
|
|
7
|
+
skills: z.string().nullable(),
|
|
8
|
+
rules: z.string().nullable(),
|
|
9
|
+
behaviors: z.string().nullable(),
|
|
10
|
+
});
|
|
11
|
+
export const ProviderDefinitionSchema = z.object({
|
|
12
|
+
id: z.enum([
|
|
13
|
+
'antigravity',
|
|
14
|
+
'claude',
|
|
15
|
+
'codex',
|
|
16
|
+
'copilot',
|
|
17
|
+
'cursor',
|
|
18
|
+
'deepseek-harness',
|
|
19
|
+
'factory',
|
|
20
|
+
'grokbot',
|
|
21
|
+
'grok-build',
|
|
22
|
+
'hermes',
|
|
23
|
+
'muse',
|
|
24
|
+
'opencode',
|
|
25
|
+
'openclaw',
|
|
26
|
+
'openhuman',
|
|
27
|
+
'pi',
|
|
28
|
+
'omp',
|
|
29
|
+
'warp',
|
|
30
|
+
'windsurf',
|
|
31
|
+
'generic',
|
|
32
|
+
]),
|
|
33
|
+
displayName: z.string().min(1),
|
|
34
|
+
aliases: z.array(z.string().min(1)),
|
|
35
|
+
status: z.enum(['stable', 'experimental', 'deprecated']),
|
|
36
|
+
builtIn: z.boolean(),
|
|
37
|
+
upstream: z.object({
|
|
38
|
+
source: url(),
|
|
39
|
+
version: z.string().min(1),
|
|
40
|
+
revision: z.string().regex(/^[0-9a-f]{40}$/).refine((value) => value !== '0'.repeat(40), { error: 'upstream.revision must be a real reviewed SHA, not all-zero' }),
|
|
41
|
+
runtime: z.string().min(1),
|
|
42
|
+
lastVerified: z.string().regex(/^\d{4}-\d{2}-\d{2}$/),
|
|
43
|
+
}).optional(),
|
|
44
|
+
surfaces: z.object({
|
|
45
|
+
primary: z.string().min(1),
|
|
46
|
+
compatibility: z.array(z.string().min(1)),
|
|
47
|
+
precedence: z.array(z.string().min(1)),
|
|
48
|
+
related: z.array(z.object({
|
|
49
|
+
id: z.string().min(1),
|
|
50
|
+
displayName: z.string().min(1),
|
|
51
|
+
relationship: z.enum(['same-provider', 'shared-adapter', 'future-provider', 'companion-standard']),
|
|
52
|
+
deployable: z.boolean(),
|
|
53
|
+
aliases: z.array(z.string().min(1)),
|
|
54
|
+
paths: z.object({
|
|
55
|
+
rules: z.array(z.string().min(1)),
|
|
56
|
+
skills: z.array(z.string().min(1)),
|
|
57
|
+
agentsMd: z.array(z.string().min(1)),
|
|
58
|
+
legacy: z.array(z.string().min(1)),
|
|
59
|
+
}),
|
|
60
|
+
notes: z.array(z.string().min(1)),
|
|
61
|
+
})),
|
|
62
|
+
}),
|
|
63
|
+
detection: z.object({
|
|
64
|
+
env: z.array(z.string().min(1)),
|
|
65
|
+
process: z.array(z.string().min(1)),
|
|
66
|
+
capabilityId: z.string().min(1),
|
|
67
|
+
runtimeEnvPriority: integer().positive().optional(),
|
|
68
|
+
}),
|
|
69
|
+
paths: z.object({
|
|
70
|
+
deployTarget: z.enum(['project', 'home', 'mixed']),
|
|
71
|
+
artifacts: ArtifactPathsSchema,
|
|
72
|
+
kernelSkills: z.string().nullable(),
|
|
73
|
+
contextDiscovery: z.object({
|
|
74
|
+
agents: z.string().nullable(),
|
|
75
|
+
skills: z.string().nullable(),
|
|
76
|
+
rules: z.string().nullable(),
|
|
77
|
+
behaviors: z.string().nullable(),
|
|
78
|
+
}),
|
|
79
|
+
configFile: z.string().nullable(),
|
|
80
|
+
contextFiles: z.object({
|
|
81
|
+
aiwgMd: z.boolean(),
|
|
82
|
+
agentsMd: z.boolean(),
|
|
83
|
+
claudeMdHook: z.boolean(),
|
|
84
|
+
hookFile: z.string().nullable(),
|
|
85
|
+
contextFile: z.string().nullable(),
|
|
86
|
+
}),
|
|
87
|
+
}),
|
|
88
|
+
context: z.object({
|
|
89
|
+
startupFiles: z.array(z.string().min(1)),
|
|
90
|
+
precedence: z.array(z.string().min(1)),
|
|
91
|
+
loadMode: z.enum(['native-include', 'prose-directive', 'config-registration', 'unsupported']),
|
|
92
|
+
includeSyntax: z.string().nullable(),
|
|
93
|
+
configRegistration: z.object({ file: z.string().min(1), key: z.string().min(1) }).nullable(),
|
|
94
|
+
bootstrapTargets: z.array(z.string().min(1)),
|
|
95
|
+
maxContextBytes: integer().positive().nullable(),
|
|
96
|
+
recommendedMaxLines: integer().positive().nullable(),
|
|
97
|
+
nestedContext: z.boolean(),
|
|
98
|
+
support: z.enum(['supported', 'degraded', 'unsupported']),
|
|
99
|
+
verification: z.object({
|
|
100
|
+
method: z.string().min(1),
|
|
101
|
+
source: z.string().min(1),
|
|
102
|
+
lastVerified: z.string().regex(/^\d{4}-\d{2}-\d{2}$/),
|
|
103
|
+
}),
|
|
104
|
+
}),
|
|
105
|
+
smithPaths: z.object({
|
|
106
|
+
agents: z.string().nullable(),
|
|
107
|
+
commands: z.string().nullable(),
|
|
108
|
+
skills: z.string().nullable(),
|
|
109
|
+
rules: z.string().nullable(),
|
|
110
|
+
fileExtension: z.enum(['.md', '.json']),
|
|
111
|
+
configFile: z.string().nullable(),
|
|
112
|
+
aggregated: z.boolean(),
|
|
113
|
+
}),
|
|
114
|
+
skillNamespace: z.object({
|
|
115
|
+
deploymentGroup: z.enum(['deep-recursion', 'one-level', 'mcp-skip']),
|
|
116
|
+
pathType: z.enum(['project', 'home-dir']),
|
|
117
|
+
skillsBaseDir: z.string().min(1),
|
|
118
|
+
subdirLayout: z.boolean(),
|
|
119
|
+
maxNameLength: integer().positive().optional(),
|
|
120
|
+
maxDescriptionLength: integer().positive().optional(),
|
|
121
|
+
appendToDescription: z.string().min(1).optional(),
|
|
122
|
+
}),
|
|
123
|
+
adapters: z.object({
|
|
124
|
+
agentFormat: z.string().min(1),
|
|
125
|
+
hookBridge: z.string().nullable(),
|
|
126
|
+
mcpInjection: z.string().nullable(),
|
|
127
|
+
contextAggregation: z.string().nullable(),
|
|
128
|
+
ruleFormat: z.string().nullable(),
|
|
129
|
+
}),
|
|
130
|
+
capabilities: z.object({
|
|
131
|
+
matrixRef: z.string().nullable(),
|
|
132
|
+
nativeFeatures: z.record(z.string(), z.boolean()),
|
|
133
|
+
emulation: z.record(z.string(), z.string().nullable()),
|
|
134
|
+
}),
|
|
135
|
+
});
|
|
136
|
+
//# sourceMappingURL=provider-definition-schema.js.map
|