@open-mercato/cli 0.10.1-develop.8279.1.7d4003fb64 → 0.10.1-develop.8289.1.9a25111d49
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/agentic/guides/ai-workflows.md +1 -0
- package/dist/agentic/guides/module-facts.json +2670 -269
- package/dist/agentic/guides/module-facts.v2.json +2673 -269
- package/dist/agentic/guides/modules/agent_orchestrator/acl-features.md +2 -1
- package/dist/agentic/guides/modules/agent_orchestrator/active-extension-bindings.md +1 -1
- package/dist/agentic/guides/modules/agent_orchestrator/backend-pages.md +3 -0
- package/dist/agentic/guides/modules/agent_orchestrator/cli-commands.md +4 -0
- package/dist/agentic/guides/modules/agent_orchestrator/contribution-resolutions.md +6 -0
- package/dist/agentic/guides/modules/agent_orchestrator/di-registrations-rich.md +32 -32
- package/dist/agentic/guides/modules/agent_orchestrator/di-service-tokens.md +14 -14
- package/dist/agentic/guides/modules/agent_orchestrator/domain-commands.md +3 -0
- package/dist/agentic/guides/modules/agent_orchestrator/events.md +2 -1
- package/dist/agentic/guides/modules/agent_orchestrator/exact-override-targets.md +104 -35
- package/dist/agentic/guides/modules/agent_orchestrator/index.md +18 -7
- package/dist/agentic/guides/modules/agent_orchestrator/setup.md +1 -1
- package/dist/agentic/guides/modules/agent_orchestrator/umes-contributions.md +6 -0
- package/dist/agentic/guides/modules/agent_orchestrator/umes-hosts.md +2 -1
- package/dist/agentic/guides/modules/agent_orchestrator/workers.md +2 -0
- package/dist/agentic/guides/modules/ai_assistant/acl-features.md +4 -1
- package/dist/agentic/guides/modules/ai_assistant/ai-tools-mcp-capabilities.md +1 -0
- package/dist/agentic/guides/modules/ai_assistant/backend-pages.md +4 -0
- package/dist/agentic/guides/modules/ai_assistant/cli-commands.md +1 -0
- package/dist/agentic/guides/modules/ai_assistant/contribution-resolutions.md +3 -0
- package/dist/agentic/guides/modules/ai_assistant/di-registrations-rich.md +5 -4
- package/dist/agentic/guides/modules/ai_assistant/di-service-tokens.md +4 -3
- package/dist/agentic/guides/modules/ai_assistant/encryption.md +3 -0
- package/dist/agentic/guides/modules/ai_assistant/entities.md +3 -0
- package/dist/agentic/guides/modules/ai_assistant/events.md +2 -1
- package/dist/agentic/guides/modules/ai_assistant/exact-override-targets.md +23 -7
- package/dist/agentic/guides/modules/ai_assistant/index.md +9 -9
- package/dist/agentic/guides/modules/ai_assistant/notifications.md +1 -0
- package/dist/agentic/guides/modules/ai_assistant/setup.md +1 -1
- package/dist/agentic/guides/modules/ai_assistant/umes-contributions.md +3 -0
- package/dist/agentic/guides/modules/ai_assistant/umes-hosts.md +4 -0
- package/dist/agentic/guides/modules/ai_assistant/workers.md +2 -1
- package/dist/agentic/guides/modules/api_docs/index.md +1 -1
- package/dist/agentic/guides/modules/api_keys/index.md +1 -1
- package/dist/agentic/guides/modules/attachments/active-extension-bindings.md +1 -0
- package/dist/agentic/guides/modules/attachments/ai-tools-mcp-capabilities.md +11 -0
- package/dist/agentic/guides/modules/attachments/backend-pages.md +1 -0
- package/dist/agentic/guides/modules/attachments/cli-commands.md +1 -0
- package/dist/agentic/guides/modules/attachments/contribution-resolutions.md +13 -0
- package/dist/agentic/guides/modules/attachments/di-registrations-rich.md +6 -6
- package/dist/agentic/guides/modules/attachments/di-service-tokens.md +5 -5
- package/dist/agentic/guides/modules/attachments/domain-commands.md +11 -0
- package/dist/agentic/guides/modules/attachments/encryption.md +12 -0
- package/dist/agentic/guides/modules/attachments/entities.md +2 -0
- package/dist/agentic/guides/modules/attachments/exact-override-targets.md +14 -6
- package/dist/agentic/guides/modules/attachments/index.md +11 -5
- package/dist/agentic/guides/modules/attachments/search-entities.md +11 -0
- package/dist/agentic/guides/modules/attachments/umes-contributions.md +13 -0
- package/dist/agentic/guides/modules/attachments/umes-hosts.md +4 -0
- package/dist/agentic/guides/modules/attachments/workers.md +2 -0
- package/dist/agentic/guides/modules/audit_logs/active-extension-bindings.md +11 -0
- package/dist/agentic/guides/modules/audit_logs/incoming-installed-contributions.md +12 -0
- package/dist/agentic/guides/modules/audit_logs/index.md +4 -2
- package/dist/agentic/guides/modules/auth/index.md +1 -1
- package/dist/agentic/guides/modules/availability/index.md +1 -1
- package/dist/agentic/guides/modules/business_rules/index.md +1 -1
- package/dist/agentic/guides/modules/carrier_inpost/index.md +1 -1
- package/dist/agentic/guides/modules/cart/index.md +1 -1
- package/dist/agentic/guides/modules/catalog/index.md +1 -1
- package/dist/agentic/guides/modules/channel_apns/index.md +1 -1
- package/dist/agentic/guides/modules/channel_discord/index.md +1 -1
- package/dist/agentic/guides/modules/channel_expo/index.md +1 -1
- package/dist/agentic/guides/modules/channel_fcm/index.md +1 -1
- package/dist/agentic/guides/modules/channel_gmail/index.md +1 -1
- package/dist/agentic/guides/modules/channel_imap/index.md +1 -1
- package/dist/agentic/guides/modules/channel_resend/index.md +1 -1
- package/dist/agentic/guides/modules/channel_ses/index.md +1 -1
- package/dist/agentic/guides/modules/channel_smtp/index.md +1 -1
- package/dist/agentic/guides/modules/checkout/index.md +1 -1
- package/dist/agentic/guides/modules/communication_channels/index.md +1 -1
- package/dist/agentic/guides/modules/configs/index.md +1 -1
- package/dist/agentic/guides/modules/content/index.md +1 -1
- package/dist/agentic/guides/modules/currencies/index.md +1 -1
- package/dist/agentic/guides/modules/customer_accounts/index.md +1 -1
- package/dist/agentic/guides/modules/customer_groups/index.md +1 -1
- package/dist/agentic/guides/modules/customers/index.md +1 -1
- package/dist/agentic/guides/modules/dashboards/index.md +1 -1
- package/dist/agentic/guides/modules/data_sync/index.md +1 -1
- package/dist/agentic/guides/modules/design_system/index.md +1 -1
- package/dist/agentic/guides/modules/devices/index.md +1 -1
- package/dist/agentic/guides/modules/dictionaries/index.md +1 -1
- package/dist/agentic/guides/modules/directory/index.md +1 -1
- package/dist/agentic/guides/modules/documents/index.md +1 -1
- package/dist/agentic/guides/modules/ecommerce/index.md +1 -1
- package/dist/agentic/guides/modules/entities/index.md +1 -1
- package/dist/agentic/guides/modules/eudr/index.md +1 -1
- package/dist/agentic/guides/modules/events/index.md +1 -1
- package/dist/agentic/guides/modules/feature_toggles/index.md +1 -1
- package/dist/agentic/guides/modules/forms/index.md +1 -1
- package/dist/agentic/guides/modules/gateway_autopay/index.md +1 -1
- package/dist/agentic/guides/modules/gateway_stripe/index.md +1 -1
- package/dist/agentic/guides/modules/gateway_tpay/index.md +1 -1
- package/dist/agentic/guides/modules/generators/index.md +1 -1
- package/dist/agentic/guides/modules/inbox_ops/index.md +1 -1
- package/dist/agentic/guides/modules/integrations/index.md +1 -1
- package/dist/agentic/guides/modules/messages/index.md +1 -1
- package/dist/agentic/guides/modules/notifications/index.md +1 -1
- package/dist/agentic/guides/modules/onboarding/index.md +1 -1
- package/dist/agentic/guides/modules/payment_gateways/index.md +1 -1
- package/dist/agentic/guides/modules/perspectives/index.md +1 -1
- package/dist/agentic/guides/modules/phone_calls/index.md +1 -1
- package/dist/agentic/guides/modules/planner/index.md +1 -1
- package/dist/agentic/guides/modules/portal/index.md +1 -1
- package/dist/agentic/guides/modules/progress/index.md +1 -1
- package/dist/agentic/guides/modules/promotions/index.md +1 -1
- package/dist/agentic/guides/modules/push_notifications/index.md +1 -1
- package/dist/agentic/guides/modules/query_index/index.md +1 -1
- package/dist/agentic/guides/modules/record_locks/index.md +1 -1
- package/dist/agentic/guides/modules/resources/index.md +1 -1
- package/dist/agentic/guides/modules/sales/index.md +1 -1
- package/dist/agentic/guides/modules/scheduler/index.md +1 -1
- package/dist/agentic/guides/modules/search/index.md +1 -1
- package/dist/agentic/guides/modules/security/index.md +1 -1
- package/dist/agentic/guides/modules/seeds/index.md +1 -1
- package/dist/agentic/guides/modules/shipping_carriers/index.md +1 -1
- package/dist/agentic/guides/modules/sso/index.md +1 -1
- package/dist/agentic/guides/modules/staff/index.md +1 -1
- package/dist/agentic/guides/modules/storage_s3/index.md +1 -1
- package/dist/agentic/guides/modules/sync_akeneo/index.md +1 -1
- package/dist/agentic/guides/modules/sync_excel/index.md +1 -1
- package/dist/agentic/guides/modules/system_status_overlays/index.md +1 -1
- package/dist/agentic/guides/modules/telemetry/index.md +1 -1
- package/dist/agentic/guides/modules/tillio/index.md +1 -1
- package/dist/agentic/guides/modules/translations/index.md +1 -1
- package/dist/agentic/guides/modules/warranty_claims/index.md +1 -1
- package/dist/agentic/guides/modules/webhooks/index.md +1 -1
- package/dist/agentic/guides/modules/wms/index.md +1 -1
- package/dist/agentic/guides/modules/workflows/index.md +1 -1
- package/dist/agentic/guides/reference-module-facts.json +1 -1
- package/dist/agentic/guides/upstream/manifest.json +1 -1
- package/dist/agentic/shared/ai/harness/README.md +3 -3
- package/dist/agentic/shared/ai/harness/RELEASE.md +4 -4
- package/dist/agentic/shared/ai/harness/cases.json +95 -2
- package/dist/agentic/shared/ai/harness/cases.schema.json +4 -4
- package/dist/agentic/shared/ai/harness/validators.json +1 -1
- package/dist/agentic/shared/ai/skills/om-create-ai-agent/SKILL.md +6 -5
- package/dist/agentic/shared/ai/skills/om-create-ai-agent/references/surface-selector.md +27 -0
- package/dist/lib/generators/extensions/agent-files.js +119 -4
- package/dist/lib/generators/extensions/agent-files.js.map +2 -2
- package/dist/lib/generators/module-facts.js +6 -4
- package/dist/lib/generators/module-facts.js.map +2 -2
- package/package.json +7 -7
- package/src/lib/generators/__tests__/agent-files-extension.test.ts +178 -0
- package/src/lib/generators/extensions/agent-files.ts +154 -4
- package/src/lib/generators/module-facts.ts +8 -4
|
@@ -4,7 +4,8 @@ import { countTokens } from "@open-mercato/shared/lib/ai/token-count";
|
|
|
4
4
|
import { resolveStandaloneSourceMirrorBase } from "../scanner.js";
|
|
5
5
|
const FRONTMATTER_RE = /^---\s*\n([\s\S]*?)\n---\s*\n?([\s\S]*)$/;
|
|
6
6
|
const JSON_FENCE_RE = /```json\s*\n([\s\S]*?)\n```/;
|
|
7
|
-
const LIST_KEYS = ["tools", "skills", "subAgents"];
|
|
7
|
+
const LIST_KEYS = ["tools", "skills", "subAgents", "requiredFeatures"];
|
|
8
|
+
const REQUIRED_FEATURE_RE = /^[A-Za-z0-9_][A-Za-z0-9_.*:-]*$/;
|
|
8
9
|
function stripQuotes(value) {
|
|
9
10
|
return value.trim().replace(/^['"]/, "").replace(/['"]$/, "").trim();
|
|
10
11
|
}
|
|
@@ -15,7 +16,13 @@ function parseAgentMarkdown(raw) {
|
|
|
15
16
|
const match = FRONTMATTER_RE.exec(raw);
|
|
16
17
|
if (!match) return null;
|
|
17
18
|
const [, frontmatterBlock, body] = match;
|
|
18
|
-
const meta = {
|
|
19
|
+
const meta = {
|
|
20
|
+
tools: [],
|
|
21
|
+
skills: [],
|
|
22
|
+
subAgents: [],
|
|
23
|
+
requiredFeatures: [],
|
|
24
|
+
instructions: body.trim()
|
|
25
|
+
};
|
|
19
26
|
const lines = frontmatterBlock.split("\n");
|
|
20
27
|
let index = 0;
|
|
21
28
|
while (index < lines.length) {
|
|
@@ -59,8 +66,18 @@ function parseAgentMarkdown(raw) {
|
|
|
59
66
|
index += 1;
|
|
60
67
|
}
|
|
61
68
|
if (!meta.id || !meta.label || !meta.description) return null;
|
|
69
|
+
meta.requiredFeatures = Array.from(new Set(meta.requiredFeatures));
|
|
62
70
|
return meta;
|
|
63
71
|
}
|
|
72
|
+
function assertRequiredFeaturesValid(features, dir) {
|
|
73
|
+
const invalid = features.find((feature) => feature.length > 200 || !REQUIRED_FEATURE_RE.test(feature));
|
|
74
|
+
if (invalid !== void 0) {
|
|
75
|
+
throw new Error(`[internal] invalid requiredFeatures entry "${invalid}" in AGENT.md at ${dir}`);
|
|
76
|
+
}
|
|
77
|
+
if (features.length > 50) {
|
|
78
|
+
throw new Error(`[internal] too many requiredFeatures (max 50) in AGENT.md at ${dir}`);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
64
81
|
function parseOutcomeKind(frontmatterBlock) {
|
|
65
82
|
for (const line of frontmatterBlock.split("\n")) {
|
|
66
83
|
const match = /^kind:\s*(.*)$/.exec(line.trim());
|
|
@@ -137,6 +154,26 @@ function assertOutcomeSchemaSupported(node, where, path2 = "$") {
|
|
|
137
154
|
assertOutcomeSchemaSupported(schema.items, where, `${path2}[]`);
|
|
138
155
|
}
|
|
139
156
|
}
|
|
157
|
+
function findOpenOutcomeObjects(node, path2 = "$") {
|
|
158
|
+
if (typeof node !== "object" || node === null || Array.isArray(node)) return [];
|
|
159
|
+
const schema = node;
|
|
160
|
+
if (schema.type === "object") {
|
|
161
|
+
const properties = typeof schema.properties === "object" && schema.properties !== null && !Array.isArray(schema.properties) ? schema.properties : {};
|
|
162
|
+
const keys = Object.keys(properties);
|
|
163
|
+
if (keys.length === 0) return [path2];
|
|
164
|
+
return keys.flatMap((key) => findOpenOutcomeObjects(properties[key], `${path2}.${key}`));
|
|
165
|
+
}
|
|
166
|
+
if (schema.type === "array") return findOpenOutcomeObjects(schema.items, `${path2}[]`);
|
|
167
|
+
return [];
|
|
168
|
+
}
|
|
169
|
+
function warnOpenOutcomeObjects(schema, where) {
|
|
170
|
+
if (!schema) return;
|
|
171
|
+
for (const openPath of findOpenOutcomeObjects(schema)) {
|
|
172
|
+
console.warn(
|
|
173
|
+
`[internal] OUTCOME.md at ${where}: the object at ${openPath} declares no properties, so it always validates to {} and any content the agent returns there is dropped. List its properties.`
|
|
174
|
+
);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
140
177
|
function sanitizeAgentName(id) {
|
|
141
178
|
return id.replace(/[^a-z0-9_-]/gi, "_");
|
|
142
179
|
}
|
|
@@ -186,6 +223,51 @@ function discoverFacts(dir) {
|
|
|
186
223
|
};
|
|
187
224
|
});
|
|
188
225
|
}
|
|
226
|
+
const GOVERNANCE_FILE = "GOVERNANCE.json";
|
|
227
|
+
const GOVERNANCE_OBJECT_KEYS = ["principal", "modelSettings"];
|
|
228
|
+
const GOVERNANCE_LIST_KEYS = ["integrity", "untrustedInputs"];
|
|
229
|
+
function isPlainObject(value) {
|
|
230
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
231
|
+
}
|
|
232
|
+
function discoverGovernance(dir) {
|
|
233
|
+
const governancePath = path.join(dir, GOVERNANCE_FILE);
|
|
234
|
+
if (!fs.existsSync(governancePath)) return void 0;
|
|
235
|
+
let parsed;
|
|
236
|
+
try {
|
|
237
|
+
parsed = JSON.parse(fs.readFileSync(governancePath, "utf8"));
|
|
238
|
+
} catch (err) {
|
|
239
|
+
const detail = err instanceof Error ? err.message : String(err);
|
|
240
|
+
throw new Error(`[internal] malformed ${GOVERNANCE_FILE} at ${dir}: ${detail}`);
|
|
241
|
+
}
|
|
242
|
+
if (!isPlainObject(parsed)) {
|
|
243
|
+
throw new Error(`[internal] malformed ${GOVERNANCE_FILE} at ${dir}: expected a JSON object`);
|
|
244
|
+
}
|
|
245
|
+
const allowed = [...GOVERNANCE_OBJECT_KEYS, ...GOVERNANCE_LIST_KEYS];
|
|
246
|
+
const unknownKey = Object.keys(parsed).find((key) => !allowed.includes(key));
|
|
247
|
+
if (unknownKey) {
|
|
248
|
+
throw new Error(
|
|
249
|
+
`[internal] malformed ${GOVERNANCE_FILE} at ${dir}: unknown key "${unknownKey}" (allowed: ${allowed.join(", ")})`
|
|
250
|
+
);
|
|
251
|
+
}
|
|
252
|
+
const governance = {};
|
|
253
|
+
for (const key of GOVERNANCE_OBJECT_KEYS) {
|
|
254
|
+
const value = parsed[key];
|
|
255
|
+
if (value === void 0) continue;
|
|
256
|
+
if (!isPlainObject(value)) {
|
|
257
|
+
throw new Error(`[internal] malformed ${GOVERNANCE_FILE} at ${dir}: "${key}" must be an object`);
|
|
258
|
+
}
|
|
259
|
+
governance[key] = value;
|
|
260
|
+
}
|
|
261
|
+
for (const key of GOVERNANCE_LIST_KEYS) {
|
|
262
|
+
const value = parsed[key];
|
|
263
|
+
if (value === void 0) continue;
|
|
264
|
+
if (!Array.isArray(value)) {
|
|
265
|
+
throw new Error(`[internal] malformed ${GOVERNANCE_FILE} at ${dir}: "${key}" must be an array`);
|
|
266
|
+
}
|
|
267
|
+
governance[key] = value;
|
|
268
|
+
}
|
|
269
|
+
return Object.keys(governance).length > 0 ? governance : void 0;
|
|
270
|
+
}
|
|
189
271
|
function sanitizeSkillName(id) {
|
|
190
272
|
const name = id.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/-+/g, "-").replace(/^-+/, "").replace(/-+$/, "");
|
|
191
273
|
return name || "skill";
|
|
@@ -332,11 +414,13 @@ function discoverSubAgents(agentDir) {
|
|
|
332
414
|
if (!agent) {
|
|
333
415
|
throw new Error(`[internal] malformed AGENT.md at ${dir}: missing id/label/description`);
|
|
334
416
|
}
|
|
417
|
+
assertRequiredFeaturesValid(agent.requiredFeatures, dir);
|
|
335
418
|
const outcome = parseOutcomeMarkdown(fs.readFileSync(outcomePath, "utf8"));
|
|
336
419
|
if (!outcome) {
|
|
337
420
|
throw new Error(`[internal] malformed OUTCOME.md at ${dir}: missing kind or JSON-Schema block`);
|
|
338
421
|
}
|
|
339
422
|
if (outcome.schema) assertOutcomeSchemaSupported(outcome.schema, dir);
|
|
423
|
+
warnOpenOutcomeObjects(outcome.schema, dir);
|
|
340
424
|
if (outcome.kind !== "research") {
|
|
341
425
|
throw new Error(
|
|
342
426
|
`[internal] sub-agent at ${dir} must be research (kind: research); only the primary proposes`
|
|
@@ -378,6 +462,7 @@ function discoverSubAgents(agentDir) {
|
|
|
378
462
|
tools: effectiveTools,
|
|
379
463
|
skills: agent.skills,
|
|
380
464
|
subAgents: [],
|
|
465
|
+
requiredFeatures: agent.requiredFeatures,
|
|
381
466
|
openCodeAgentName: sanitizeAgentName(agent.id),
|
|
382
467
|
skillsContent: effectiveSkillsContent,
|
|
383
468
|
subAgentsContent: [],
|
|
@@ -387,6 +472,7 @@ function discoverSubAgents(agentDir) {
|
|
|
387
472
|
model: agent.model,
|
|
388
473
|
sampleInput: discoverSampleInput(dir),
|
|
389
474
|
facts: discoverFacts(dir),
|
|
475
|
+
governance: discoverGovernance(dir),
|
|
390
476
|
tokenUsage: discoverAgentTokenUsage(dir),
|
|
391
477
|
sourceFiles: collectAgentFiles(dir)
|
|
392
478
|
});
|
|
@@ -453,7 +539,7 @@ function discoverAgentTokenUsage(agentDir, depth = 0) {
|
|
|
453
539
|
const total = self + subAgents.reduce((sum, s) => sum + s.tokens, 0);
|
|
454
540
|
return { total, self, agent, outcome, skills, tools, subAgents };
|
|
455
541
|
}
|
|
456
|
-
const AGENT_AUX_FILES = ["SAMPLE.json", "FACTS.json"];
|
|
542
|
+
const AGENT_AUX_FILES = ["SAMPLE.json", "FACTS.json", GOVERNANCE_FILE];
|
|
457
543
|
function collectAgentFiles(agentDir, prefix = "", depth = 0) {
|
|
458
544
|
const files = [];
|
|
459
545
|
const add = (relativePath, inContext) => {
|
|
@@ -635,6 +721,9 @@ function renderDescriptor(agent, indent) {
|
|
|
635
721
|
${nested}
|
|
636
722
|
${indent} ],`);
|
|
637
723
|
}
|
|
724
|
+
if (agent.requiredFeatures.length > 0) {
|
|
725
|
+
optional.push(`${indent} requiredFeatures: ${JSON.stringify(agent.requiredFeatures)},`);
|
|
726
|
+
}
|
|
638
727
|
if (agent.maxSteps != null) optional.push(`${indent} maxSteps: ${agent.maxSteps},`);
|
|
639
728
|
if (agent.provider != null) optional.push(`${indent} provider: ${JSON.stringify(agent.provider)},`);
|
|
640
729
|
if (agent.model != null) optional.push(`${indent} model: ${JSON.stringify(agent.model)},`);
|
|
@@ -644,6 +733,9 @@ ${indent} ],`);
|
|
|
644
733
|
if (agent.facts !== void 0) {
|
|
645
734
|
optional.push(`${indent} facts: ${JSON.stringify(agent.facts)},`);
|
|
646
735
|
}
|
|
736
|
+
if (agent.governance !== void 0) {
|
|
737
|
+
optional.push(`${indent} governance: ${JSON.stringify(agent.governance)},`);
|
|
738
|
+
}
|
|
647
739
|
const skillsContent = agent.skillsContent.map((skill) => ({
|
|
648
740
|
id: skill.id,
|
|
649
741
|
instructions: skill.instructions,
|
|
@@ -728,6 +820,13 @@ export type FileAgentFact = {
|
|
|
728
820
|
format?: 'text' | 'number' | 'boolean' | 'percent'
|
|
729
821
|
}
|
|
730
822
|
|
|
823
|
+
export type FileAgentGovernance = {
|
|
824
|
+
principal?: Record<string, unknown>
|
|
825
|
+
integrity?: unknown[]
|
|
826
|
+
untrustedInputs?: unknown[]
|
|
827
|
+
modelSettings?: Record<string, unknown>
|
|
828
|
+
}
|
|
829
|
+
|
|
731
830
|
export type FileAgentDescriptor = {
|
|
732
831
|
id: string
|
|
733
832
|
moduleId: string
|
|
@@ -750,7 +849,7 @@ export type FileAgentDescriptor = {
|
|
|
750
849
|
tokenUsage?: AgentTokenUsage
|
|
751
850
|
/**
|
|
752
851
|
* Baked raw content of every construction file (AGENT.md, OUTCOME.md, skills,
|
|
753
|
-
* tools, sub-agents, and auxiliary SAMPLE.json/FACTS.json), for the read-only
|
|
852
|
+
* tools, sub-agents, and auxiliary SAMPLE.json/FACTS.json/GOVERNANCE.json), for the read-only
|
|
754
853
|
* Files tab. Each carries its \`o200k_base\` token count; paths are relative to
|
|
755
854
|
* the agent root (sub-agent files prefixed \`sub-agents/<id>/\`). Baked so the
|
|
756
855
|
* runtime never reads agent dirs from disk.
|
|
@@ -762,6 +861,11 @@ export type FileAgentDescriptor = {
|
|
|
762
861
|
* 1). Absent for agents without sub-agents and for sub-agents themselves.
|
|
763
862
|
*/
|
|
764
863
|
subAgentDescriptors?: FileAgentDescriptor[]
|
|
864
|
+
/**
|
|
865
|
+
* ACL features the invoker must hold to run this agent, from AGENT.md
|
|
866
|
+
* \`requiredFeatures\`. Absent when the agent declares none.
|
|
867
|
+
*/
|
|
868
|
+
requiredFeatures?: string[]
|
|
765
869
|
maxSteps?: number
|
|
766
870
|
provider?: string
|
|
767
871
|
model?: string
|
|
@@ -776,6 +880,13 @@ export type FileAgentDescriptor = {
|
|
|
776
880
|
* input / proposal payload / run output.
|
|
777
881
|
*/
|
|
778
882
|
facts?: FileAgentFact[]
|
|
883
|
+
/**
|
|
884
|
+
* Optional governance declarations read from \`agents/<id>/GOVERNANCE.json\`:
|
|
885
|
+
* the same \`principal\`, \`integrity\`, \`untrustedInputs\` and
|
|
886
|
+
* \`modelSettings\` keys \`defineAgent\` accepts, as plain JSON. The loader
|
|
887
|
+
* validates them with the \`defineAgent\` parsers.
|
|
888
|
+
*/
|
|
889
|
+
governance?: FileAgentGovernance
|
|
779
890
|
}
|
|
780
891
|
|
|
781
892
|
export const fileAgentDescriptors: FileAgentDescriptor[] = [${descriptors ? `
|
|
@@ -804,11 +915,13 @@ function createAgentFilesExtension(resolver) {
|
|
|
804
915
|
if (!agent) {
|
|
805
916
|
throw new Error(`[internal] malformed AGENT.md at ${dir}: missing id/label/description`);
|
|
806
917
|
}
|
|
918
|
+
assertRequiredFeaturesValid(agent.requiredFeatures, dir);
|
|
807
919
|
const outcome = parseOutcomeMarkdown(fs.readFileSync(outcomePath, "utf8"));
|
|
808
920
|
if (!outcome) {
|
|
809
921
|
throw new Error(`[internal] malformed OUTCOME.md at ${dir}: missing kind or JSON-Schema block`);
|
|
810
922
|
}
|
|
811
923
|
if (outcome.schema) assertOutcomeSchemaSupported(outcome.schema, dir);
|
|
924
|
+
warnOpenOutcomeObjects(outcome.schema, dir);
|
|
812
925
|
if (!/^[a-z0-9][a-z0-9._-]*$/.test(agent.id)) {
|
|
813
926
|
throw new Error(
|
|
814
927
|
`[internal] invalid agent id "${agent.id}" at ${dir}: use lowercase [a-z0-9._-] (e.g. "module.agent")`
|
|
@@ -851,6 +964,7 @@ function createAgentFilesExtension(resolver) {
|
|
|
851
964
|
tools: effectiveTools,
|
|
852
965
|
skills: agent.skills,
|
|
853
966
|
subAgents: agent.subAgents,
|
|
967
|
+
requiredFeatures: agent.requiredFeatures,
|
|
854
968
|
openCodeAgentName: sanitizeAgentName(agent.id),
|
|
855
969
|
skillsContent: effectiveSkillsContent,
|
|
856
970
|
subAgentsContent,
|
|
@@ -860,6 +974,7 @@ function createAgentFilesExtension(resolver) {
|
|
|
860
974
|
model: agent.model,
|
|
861
975
|
sampleInput: discoverSampleInput(dir),
|
|
862
976
|
facts: discoverFacts(dir),
|
|
977
|
+
governance: discoverGovernance(dir),
|
|
863
978
|
tokenUsage: discoverAgentTokenUsage(dir),
|
|
864
979
|
sourceFiles: collectAgentFiles(dir)
|
|
865
980
|
});
|