ai-capability-framework 1.0.3 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +42 -0
- package/README.md +38 -30
- package/ROADMAP.md +14 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +32 -1
- package/dist/discovery/bindings.d.ts +7 -0
- package/dist/discovery/bindings.d.ts.map +1 -0
- package/dist/discovery/bindings.js +24 -0
- package/dist/discovery/budget.d.ts +17 -0
- package/dist/discovery/budget.d.ts.map +1 -0
- package/dist/discovery/budget.js +77 -0
- package/dist/discovery/configuration.d.ts +10 -0
- package/dist/discovery/configuration.d.ts.map +1 -0
- package/dist/discovery/configuration.js +63 -0
- package/dist/discovery/corpus.d.ts +8 -0
- package/dist/discovery/corpus.d.ts.map +1 -0
- package/dist/discovery/corpus.js +64 -0
- package/dist/discovery/diagnostics.d.ts +15 -0
- package/dist/discovery/diagnostics.d.ts.map +1 -0
- package/dist/discovery/diagnostics.js +11 -0
- package/dist/discovery/discoverer.d.ts +23 -0
- package/dist/discovery/discoverer.d.ts.map +1 -0
- package/dist/discovery/discoverer.js +261 -0
- package/dist/discovery/embedding-configuration.d.ts +12 -0
- package/dist/discovery/embedding-configuration.d.ts.map +1 -0
- package/dist/discovery/embedding-configuration.js +81 -0
- package/dist/discovery/embedding-types.d.ts +75 -0
- package/dist/discovery/embedding-types.d.ts.map +1 -0
- package/dist/discovery/embedding-types.js +1 -0
- package/dist/discovery/embeddings.d.ts +38 -0
- package/dist/discovery/embeddings.d.ts.map +1 -0
- package/dist/discovery/embeddings.js +71 -0
- package/dist/discovery/evaluation-validation.d.ts +8 -0
- package/dist/discovery/evaluation-validation.d.ts.map +1 -0
- package/dist/discovery/evaluation-validation.js +19 -0
- package/dist/discovery/evaluation.d.ts +84 -0
- package/dist/discovery/evaluation.d.ts.map +1 -0
- package/dist/discovery/evaluation.js +310 -0
- package/dist/discovery/export.d.ts +14 -0
- package/dist/discovery/export.d.ts.map +1 -0
- package/dist/discovery/export.js +81 -0
- package/dist/discovery/facade.d.ts +82 -0
- package/dist/discovery/facade.d.ts.map +1 -0
- package/dist/discovery/facade.js +266 -0
- package/dist/discovery/fingerprint.d.ts +71 -0
- package/dist/discovery/fingerprint.d.ts.map +1 -0
- package/dist/discovery/fingerprint.js +67 -0
- package/dist/discovery/index-builder.d.ts +3 -0
- package/dist/discovery/index-builder.d.ts.map +1 -0
- package/dist/discovery/index-builder.js +129 -0
- package/dist/discovery/index-validation.d.ts +12 -0
- package/dist/discovery/index-validation.d.ts.map +1 -0
- package/dist/discovery/index-validation.js +117 -0
- package/dist/discovery/index.d.ts +32 -0
- package/dist/discovery/index.d.ts.map +1 -0
- package/dist/discovery/index.js +18 -0
- package/dist/discovery/json-snapshot.d.ts +3 -0
- package/dist/discovery/json-snapshot.d.ts.map +1 -0
- package/dist/discovery/json-snapshot.js +11 -0
- package/dist/discovery/lexical.d.ts +12 -0
- package/dist/discovery/lexical.d.ts.map +1 -0
- package/dist/discovery/lexical.js +26 -0
- package/dist/discovery/metadata.d.ts +4 -0
- package/dist/discovery/metadata.d.ts.map +1 -0
- package/dist/discovery/metadata.js +33 -0
- package/dist/discovery/ranking.d.ts +7 -0
- package/dist/discovery/ranking.d.ts.map +1 -0
- package/dist/discovery/ranking.js +68 -0
- package/dist/discovery/replay.d.ts +50 -0
- package/dist/discovery/replay.d.ts.map +1 -0
- package/dist/discovery/replay.js +175 -0
- package/dist/discovery/retrieval-policy.d.ts +5 -0
- package/dist/discovery/retrieval-policy.d.ts.map +1 -0
- package/dist/discovery/retrieval-policy.js +10 -0
- package/dist/discovery/router.d.ts +39 -0
- package/dist/discovery/router.d.ts.map +1 -0
- package/dist/discovery/router.js +98 -0
- package/dist/discovery/selection-attempt.d.ts +20 -0
- package/dist/discovery/selection-attempt.d.ts.map +1 -0
- package/dist/discovery/selection-attempt.js +39 -0
- package/dist/discovery/selection-cards.d.ts +12 -0
- package/dist/discovery/selection-cards.d.ts.map +1 -0
- package/dist/discovery/selection-cards.js +79 -0
- package/dist/discovery/selection-configuration.d.ts +18 -0
- package/dist/discovery/selection-configuration.d.ts.map +1 -0
- package/dist/discovery/selection-configuration.js +71 -0
- package/dist/discovery/selection-response.d.ts +13 -0
- package/dist/discovery/selection-response.d.ts.map +1 -0
- package/dist/discovery/selection-response.js +47 -0
- package/dist/discovery/selection-types.d.ts +18 -0
- package/dist/discovery/selection-types.d.ts.map +1 -0
- package/dist/discovery/selection-types.js +1 -0
- package/dist/discovery/selection.d.ts +6 -0
- package/dist/discovery/selection.d.ts.map +1 -0
- package/dist/discovery/selection.js +145 -0
- package/dist/discovery/types.d.ts +291 -0
- package/dist/discovery/types.d.ts.map +1 -0
- package/dist/discovery/types.js +1 -0
- package/dist/discovery/usage.d.ts +2 -0
- package/dist/discovery/usage.d.ts.map +1 -0
- package/dist/discovery/usage.js +1 -0
- package/dist/discovery/vectors.d.ts +5 -0
- package/dist/discovery/vectors.d.ts.map +1 -0
- package/dist/discovery/vectors.js +43 -0
- package/dist/discovery/versions.d.ts +37 -0
- package/dist/discovery/versions.d.ts.map +1 -0
- package/dist/discovery/versions.js +36 -0
- package/dist/evals-live/live-eval-runner.d.ts +1 -0
- package/dist/evals-live/live-eval-runner.d.ts.map +1 -1
- package/dist/evals-live/live-eval-runner.js +12 -1
- package/dist/evals-live/types.d.ts +3 -0
- package/dist/evals-live/types.d.ts.map +1 -1
- package/dist/generated/manifest-types.d.ts +3655 -0
- package/dist/generated/manifest-types.d.ts.map +1 -1
- package/dist/loader.d.ts.map +1 -1
- package/dist/loader.js +8 -0
- package/dist/mcp-server/server.d.ts.map +1 -1
- package/dist/mcp-server/server.js +11 -2
- package/dist/mcp-server/types.d.ts +4 -0
- package/dist/mcp-server/types.d.ts.map +1 -1
- package/dist/observability/redaction.d.ts.map +1 -1
- package/dist/observability/redaction.js +6 -2
- package/dist/observability/types.d.ts +1 -1
- package/dist/observability/types.d.ts.map +1 -1
- package/dist/openai/index.d.ts +2 -0
- package/dist/openai/index.d.ts.map +1 -1
- package/dist/openai/index.js +1 -0
- package/dist/openai/responses-runner.d.ts +1 -1
- package/dist/openai/responses-runner.d.ts.map +1 -1
- package/dist/openai/responses-runner.js +134 -7
- package/dist/openai/selection-client.d.ts +28 -0
- package/dist/openai/selection-client.d.ts.map +1 -0
- package/dist/openai/selection-client.js +95 -0
- package/dist/openai/tool-loop.js +1 -1
- package/dist/openai/types.d.ts +19 -2
- package/dist/openai/types.d.ts.map +1 -1
- package/dist/replay/discovery-snapshot.d.ts +10 -0
- package/dist/replay/discovery-snapshot.d.ts.map +1 -0
- package/dist/replay/discovery-snapshot.js +17 -0
- package/dist/replay/recorder.d.ts.map +1 -1
- package/dist/replay/recorder.js +4 -0
- package/dist/replay/redaction.js +5 -1
- package/dist/replay/replayer.d.ts.map +1 -1
- package/dist/replay/replayer.js +14 -1
- package/dist/replay/types.d.ts +3 -0
- package/dist/replay/types.d.ts.map +1 -1
- package/dist/replay/validation.d.ts.map +1 -1
- package/dist/replay/validation.js +6 -0
- package/dist/runtime/bounded-json.d.ts +4 -0
- package/dist/runtime/bounded-json.d.ts.map +1 -0
- package/dist/runtime/bounded-json.js +74 -0
- package/dist/runtime/eligibility.d.ts +4 -0
- package/dist/runtime/eligibility.d.ts.map +1 -0
- package/dist/runtime/eligibility.js +128 -0
- package/dist/runtime/index.d.ts +5 -1
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/index.js +2 -0
- package/dist/runtime/provider-attempt.d.ts +11 -0
- package/dist/runtime/provider-attempt.d.ts.map +1 -0
- package/dist/runtime/provider-attempt.js +221 -0
- package/dist/runtime/provider-run.d.ts +10 -0
- package/dist/runtime/provider-run.d.ts.map +1 -0
- package/dist/runtime/provider-run.js +123 -0
- package/dist/runtime/provider-stop.d.ts +9 -0
- package/dist/runtime/provider-stop.d.ts.map +1 -0
- package/dist/runtime/provider-stop.js +28 -0
- package/dist/runtime/provider-types.d.ts +189 -0
- package/dist/runtime/provider-types.d.ts.map +1 -0
- package/dist/runtime/provider-types.js +1 -0
- package/dist/runtime/provider-usage.d.ts +9 -0
- package/dist/runtime/provider-usage.d.ts.map +1 -0
- package/dist/runtime/provider-usage.js +69 -0
- package/dist/runtime/router.d.ts.map +1 -1
- package/dist/runtime/router.js +3 -118
- package/dist/runtime/types.d.ts +9 -0
- package/dist/runtime/types.d.ts.map +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/validator.d.ts +3 -0
- package/dist/validator.d.ts.map +1 -1
- package/dist/validator.js +32 -0
- package/docs/api/public-api-policy.md +10 -0
- package/docs/api/stable-workflow.md +58 -0
- package/docs/api.md +7 -0
- package/docs/capability-manifests.md +24 -0
- package/docs/development.md +22 -0
- package/docs/discovery.md +186 -0
- package/docs/evals/discovery-live.md +199 -0
- package/docs/evals/discovery-qualification.md +158 -0
- package/docs/evals/overview.md +9 -0
- package/docs/getting-started/installation.md +11 -12
- package/docs/getting-started/openai-quickstart.md +16 -5
- package/docs/getting-started/provider-neutral-quickstart.md +247 -88
- package/docs/getting-started/quickstart.md +8 -30
- package/docs/index.md +10 -0
- package/docs/release.md +29 -5
- package/docs/runtime.md +27 -0
- package/docs/start-here.md +23 -134
- package/examples/12-capability-discovery-selection/README.md +346 -0
- package/examples/12-capability-discovery-selection/customer-cases.mjs +52 -0
- package/examples/12-capability-discovery-selection/customer-harness.mjs +91 -0
- package/examples/12-capability-discovery-selection/customer-request-example.mjs +320 -0
- package/examples/12-capability-discovery-selection/discovery-example.mjs +175 -0
- package/examples/12-capability-discovery-selection/discovery-fixtures/three-domains.suite.json +7887 -0
- package/examples/12-capability-discovery-selection/discovery-fixtures/three-domains.v2.suite.json +8167 -0
- package/examples/12-capability-discovery-selection/discovery-fixtures/three-domains.v3.suite.json +8342 -0
- package/examples/12-capability-discovery-selection/evaluation/application.mjs +305 -0
- package/examples/12-capability-discovery-selection/evaluation/campaign.mjs +248 -0
- package/examples/12-capability-discovery-selection/evaluation/clients.mjs +433 -0
- package/examples/12-capability-discovery-selection/evaluation/continuation.mjs +208 -0
- package/examples/12-capability-discovery-selection/evaluation/durable-budget.mjs +420 -0
- package/examples/12-capability-discovery-selection/evaluation/freeze.mjs +9 -0
- package/examples/12-capability-discovery-selection/evaluation/harness.mjs +618 -0
- package/examples/12-capability-discovery-selection/evaluation/mock-host.mjs +260 -0
- package/examples/12-capability-discovery-selection/evaluation/preflight.mjs +115 -0
- package/examples/12-capability-discovery-selection/evaluation/qualification-workflows.mjs +87 -0
- package/examples/12-capability-discovery-selection/evaluation/regrade.mjs +281 -0
- package/examples/12-capability-discovery-selection/evaluation/report.mjs +517 -0
- package/examples/12-capability-discovery-selection/evaluation/runner.mjs +613 -0
- package/examples/12-capability-discovery-selection/evaluation/saved-campaign.mjs +385 -0
- package/examples/12-capability-discovery-selection/evaluation/wording.mjs +115 -0
- package/examples/12-capability-discovery-selection/evaluation/workflow-application.mjs +378 -0
- package/examples/12-capability-discovery-selection/evaluation/workflow-cases.mjs +90 -0
- package/examples/12-capability-discovery-selection/evaluation-example.mjs +154 -0
- package/examples/12-capability-discovery-selection/hybrid-example.mjs +174 -0
- package/examples/12-capability-discovery-selection/mock-embeddings.mjs +101 -0
- package/examples/12-capability-discovery-selection/mock-selection.mjs +78 -0
- package/examples/12-capability-discovery-selection/pipeline-example.mjs +496 -0
- package/examples/12-capability-discovery-selection/retrieval-cases.mjs +31 -0
- package/examples/12-capability-discovery-selection/run-campaign-mock.mjs +40 -0
- package/examples/12-capability-discovery-selection/run-customer-mock.mjs +15 -0
- package/examples/12-capability-discovery-selection/run-evaluation-live.mjs +10 -0
- package/examples/12-capability-discovery-selection/run-evaluation-mock.mjs +3 -0
- package/examples/12-capability-discovery-selection/run-evaluation-regrade.mjs +71 -0
- package/examples/12-capability-discovery-selection/run-hybrid-mock.mjs +3 -0
- package/examples/12-capability-discovery-selection/run-mock.mjs +3 -0
- package/examples/12-capability-discovery-selection/run-pipeline-mock.mjs +2 -0
- package/examples/12-capability-discovery-selection/run-selector-mock.mjs +3 -0
- package/examples/12-capability-discovery-selection/selection-example.mjs +88 -0
- package/package.json +17 -4
- package/schemas/discovery/embedding-index.schema.json +71 -0
- package/schemas/discovery/eval-observations.schema.json +409 -0
- package/schemas/discovery/eval-suite.schema.json +375 -0
- package/schemas/discovery/metadata.schema.json +30 -0
- package/schemas/discovery/selection-response.schema.json +47 -0
- package/schemas/replay/discovery-snapshot.schema.json +335 -0
|
@@ -1,106 +1,265 @@
|
|
|
1
1
|
# Provider-Neutral Quickstart
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
Start in an empty project with Node.js 20, 22 or 24 and npm. This walkthrough uses
|
|
4
|
+
synthetic data and a deterministic mock model: no API key, provider SDK, source checkout
|
|
5
|
+
or framework build is required.
|
|
6
6
|
|
|
7
|
-
##
|
|
7
|
+
## 1. Install
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
-
|
|
11
|
-
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
## 1. Install And Build
|
|
15
|
-
|
|
16
|
-
```bash
|
|
17
|
-
npm ci
|
|
18
|
-
npm run build
|
|
9
|
+
```sh
|
|
10
|
+
mkdir aicf-example
|
|
11
|
+
cd aicf-example
|
|
12
|
+
npm init -y
|
|
13
|
+
npm install ai-capability-framework
|
|
19
14
|
```
|
|
20
15
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
16
|
+
The stable package includes discovery. Your ordinary model/tool loop chooses among
|
|
17
|
+
eligible tools; lexical discovery makes no model or embedding calls.
|
|
18
|
+
|
|
19
|
+
## 2. Describe your capability
|
|
20
|
+
|
|
21
|
+
Create a `capabilities` directory. Save this as `capabilities/ticket.json`:
|
|
22
|
+
|
|
23
|
+
```json
|
|
24
|
+
{
|
|
25
|
+
"schema_version": "1.0",
|
|
26
|
+
"id": "support.ticket.get",
|
|
27
|
+
"version": "1.0.0",
|
|
28
|
+
"status": "active",
|
|
29
|
+
"name": "Read support ticket",
|
|
30
|
+
"summary": "Read a support ticket by ticket ID.",
|
|
31
|
+
"model_description": "Read a synthetic ticket the current user is allowed to view. Does not change data.",
|
|
32
|
+
"capability_type": "read_data",
|
|
33
|
+
"autonomy_tier": "A1",
|
|
34
|
+
"risk_tier": "low",
|
|
35
|
+
"input_schema": {
|
|
36
|
+
"type": "object",
|
|
37
|
+
"additionalProperties": false,
|
|
38
|
+
"required": ["ticket_id"],
|
|
39
|
+
"properties": { "ticket_id": { "type": "string", "pattern": "^TCK-[0-9]+$" } }
|
|
40
|
+
},
|
|
41
|
+
"output_schema": {
|
|
42
|
+
"type": "object",
|
|
43
|
+
"additionalProperties": false,
|
|
44
|
+
"required": ["ticket_id", "status"],
|
|
45
|
+
"properties": { "ticket_id": { "type": "string" }, "status": { "type": "string" } }
|
|
46
|
+
},
|
|
47
|
+
"side_effects": {
|
|
48
|
+
"reads_data": true,
|
|
49
|
+
"writes_data": false,
|
|
50
|
+
"creates_records": false,
|
|
51
|
+
"updates_records": false,
|
|
52
|
+
"deletes_records": false,
|
|
53
|
+
"sends_external_messages": false,
|
|
54
|
+
"charges_money": false,
|
|
55
|
+
"refunds_money": false,
|
|
56
|
+
"changes_permissions": false,
|
|
57
|
+
"triggers_external_workflow": false,
|
|
58
|
+
"irreversible": false
|
|
59
|
+
},
|
|
60
|
+
"authorization": {
|
|
61
|
+
"permissions": ["ticket.read"],
|
|
62
|
+
"tenant_scoped": true,
|
|
63
|
+
"requires_user_context": true
|
|
64
|
+
},
|
|
65
|
+
"policy": { "approval_required": false, "max_autonomy_tier": "A1" },
|
|
66
|
+
"lifecycle": {
|
|
67
|
+
"prepare": false,
|
|
68
|
+
"preview": false,
|
|
69
|
+
"approve": false,
|
|
70
|
+
"commit": false,
|
|
71
|
+
"verify": false,
|
|
72
|
+
"audit": true
|
|
73
|
+
},
|
|
74
|
+
"observability": { "log_inputs": "redacted", "log_outputs": "summary" }
|
|
75
|
+
}
|
|
26
76
|
```
|
|
27
77
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
78
|
+
The manifest describes the contract; your handler supplies the implementation.
|
|
79
|
+
Production identity and permissions must come from trusted host authentication. Handlers
|
|
80
|
+
must enforce access to the requested resource within that tenant.
|
|
81
|
+
|
|
82
|
+
## 3. Load, discover and execute
|
|
83
|
+
|
|
84
|
+
Save this as `app.mjs`:
|
|
85
|
+
|
|
86
|
+
```js
|
|
87
|
+
import {
|
|
88
|
+
buildRegistry,
|
|
89
|
+
loadManifests,
|
|
90
|
+
validateManifests,
|
|
91
|
+
toOpenAIResponsesToolName
|
|
92
|
+
} from "ai-capability-framework";
|
|
93
|
+
import { createCapabilityDiscovery } from "ai-capability-framework/discovery";
|
|
94
|
+
import {
|
|
95
|
+
AicfHandlerRegistry,
|
|
96
|
+
AicfToolExecutor,
|
|
97
|
+
AicfActionLifecycleManager,
|
|
98
|
+
DefaultContextBuilder,
|
|
99
|
+
DefaultPolicyBroker,
|
|
100
|
+
InMemoryApprovalStore,
|
|
101
|
+
InMemoryIdempotencyStore,
|
|
102
|
+
InMemoryPreparedActionStore
|
|
103
|
+
} from "ai-capability-framework/runtime";
|
|
104
|
+
import {
|
|
105
|
+
MockOpenAIResponsesClient,
|
|
106
|
+
mockFunctionCallResponse,
|
|
107
|
+
mockTextResponse,
|
|
108
|
+
runOpenAIResponses
|
|
109
|
+
} from "ai-capability-framework/openai";
|
|
110
|
+
|
|
111
|
+
const loaded = await loadManifests({ path: "capabilities" });
|
|
112
|
+
if (loaded.errors.length || !validateManifests(loaded.manifests).valid) {
|
|
113
|
+
throw new Error("Invalid capability manifests.");
|
|
114
|
+
}
|
|
115
|
+
const registry = buildRegistry(loaded.manifests);
|
|
116
|
+
// Synthetic identity for this mock only. Production identity comes from your host.
|
|
117
|
+
const runtimeContext = {
|
|
118
|
+
environment: "test",
|
|
119
|
+
runId: "run_example",
|
|
120
|
+
requestId: "request_example",
|
|
121
|
+
startedAt: new Date().toISOString(),
|
|
122
|
+
account: { accountId: "account_example", tenantId: "tenant_example" },
|
|
123
|
+
subject: {
|
|
124
|
+
actorType: "user",
|
|
125
|
+
userId: "user_example",
|
|
126
|
+
roles: [],
|
|
127
|
+
permissions: ["ticket.read"]
|
|
128
|
+
},
|
|
129
|
+
autonomy: {
|
|
130
|
+
autonomyTier: "A1",
|
|
131
|
+
maxRiskTier: "low",
|
|
132
|
+
allowSideEffects: false,
|
|
133
|
+
allowExternalMessages: false,
|
|
134
|
+
allowMoneyMovement: false,
|
|
135
|
+
allowPermissionChanges: false
|
|
136
|
+
},
|
|
137
|
+
facts: {},
|
|
138
|
+
metadata: {}
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
// Set up the existing runtime once. These example stores live in one process.
|
|
142
|
+
const handlers = new AicfHandlerRegistry({ registry });
|
|
143
|
+
let reads = 0;
|
|
144
|
+
handlers.register({
|
|
145
|
+
capabilityId: "support.ticket.get",
|
|
146
|
+
read: ({ args }) => {
|
|
147
|
+
reads += 1;
|
|
148
|
+
return { ticket_id: args.ticket_id, status: "open" };
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
const policyBroker = new DefaultPolicyBroker();
|
|
152
|
+
const actionLifecycle = new AicfActionLifecycleManager({
|
|
153
|
+
registry,
|
|
154
|
+
handlers,
|
|
155
|
+
policyBroker,
|
|
156
|
+
approvalStore: new InMemoryApprovalStore(),
|
|
157
|
+
idempotencyStore: new InMemoryIdempotencyStore(),
|
|
158
|
+
preparedActionStore: new InMemoryPreparedActionStore()
|
|
159
|
+
});
|
|
160
|
+
const executor = new AicfToolExecutor({
|
|
161
|
+
registry,
|
|
162
|
+
handlers,
|
|
163
|
+
policyBroker,
|
|
164
|
+
actionLifecycle
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
const task = { id: "read-ticket", text: "Read ticket TCK-100." };
|
|
168
|
+
const discovery = createCapabilityDiscovery({ registry });
|
|
169
|
+
const [result] = await discovery.search({ tasks: [task], runtimeContext });
|
|
170
|
+
if (result.status !== "matched")
|
|
171
|
+
throw new Error("No actionable shortlist; clarify or handle the failure.");
|
|
172
|
+
const client = new MockOpenAIResponsesClient([
|
|
173
|
+
mockFunctionCallResponse({
|
|
174
|
+
name: toOpenAIResponsesToolName("support.ticket.get"),
|
|
175
|
+
callId: "read_example",
|
|
176
|
+
args: { ticket_id: "TCK-100" }
|
|
177
|
+
}),
|
|
178
|
+
mockTextResponse("Ticket TCK-100 is open.")
|
|
179
|
+
]);
|
|
180
|
+
const loop = await runOpenAIResponses({
|
|
181
|
+
registry,
|
|
182
|
+
executor,
|
|
183
|
+
client,
|
|
184
|
+
model: "mock-model",
|
|
185
|
+
runtimeContext,
|
|
186
|
+
contextBuilder: new DefaultContextBuilder(),
|
|
187
|
+
userInput: { text: task.text },
|
|
188
|
+
router: discovery.routerFor(result),
|
|
189
|
+
maxToolCalls: 1,
|
|
190
|
+
maxTurns: 2
|
|
191
|
+
});
|
|
192
|
+
if (
|
|
193
|
+
loop.status !== "completed" ||
|
|
194
|
+
reads !== 1 ||
|
|
195
|
+
loop.toolResults[0]?.status !== "success"
|
|
196
|
+
) {
|
|
197
|
+
throw new Error("The mock read did not complete.");
|
|
198
|
+
}
|
|
199
|
+
console.log(
|
|
200
|
+
JSON.stringify(
|
|
201
|
+
{
|
|
202
|
+
queryId: result.queryId,
|
|
203
|
+
capabilityId: loop.toolCalls[0].capabilityId,
|
|
204
|
+
toolStatus: loop.toolResults[0].status,
|
|
205
|
+
data: loop.toolResults[0].data,
|
|
206
|
+
reads,
|
|
207
|
+
ordinaryModelTurns: client.requests.length,
|
|
208
|
+
discoveryProviderCalls: result.usage.totals.providerAttempts
|
|
209
|
+
},
|
|
210
|
+
null,
|
|
211
|
+
2
|
|
212
|
+
)
|
|
213
|
+
);
|
|
41
214
|
```
|
|
42
215
|
|
|
43
|
-
|
|
216
|
+
Run the installed CLI and app:
|
|
44
217
|
|
|
45
|
-
```
|
|
46
|
-
|
|
218
|
+
```sh
|
|
219
|
+
npx aicf validate capabilities
|
|
220
|
+
node app.mjs
|
|
47
221
|
```
|
|
48
222
|
|
|
49
|
-
|
|
223
|
+
The CLI validates one manifest. The app reports `queryId: "read-ticket"`,
|
|
224
|
+
`capabilityId: "support.ticket.get"`, `toolStatus: "success"`, one read, two mocked
|
|
225
|
+
ordinary-model turns and zero discovery-provider calls. The ticket is `TCK-100` with
|
|
226
|
+
status `open`. No real provider calls occur.
|
|
50
227
|
|
|
51
|
-
|
|
52
|
-
node dist/cli.js inspect examples
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
Expected output excerpt:
|
|
56
|
-
|
|
57
|
-
```text
|
|
58
|
-
Capabilities:
|
|
59
|
-
- support.ticket.get
|
|
60
|
-
- support.refund.prepare_case
|
|
61
|
-
- support.refund.commit_case
|
|
62
|
-
```
|
|
228
|
+
## 4. Try the complete customer request
|
|
63
229
|
|
|
64
|
-
|
|
230
|
+
Run the packaged example from this same project:
|
|
65
231
|
|
|
66
|
-
```
|
|
67
|
-
node
|
|
232
|
+
```sh
|
|
233
|
+
node node_modules/ai-capability-framework/examples/12-capability-discovery-selection/run-customer-mock.mjs
|
|
68
234
|
```
|
|
69
235
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
[
|
|
100
|
-
routed AICF capability slice, but AICF validation and policy remain the authority.
|
|
101
|
-
|
|
102
|
-
Useful next steps:
|
|
103
|
-
|
|
104
|
-
- [OpenAI quickstart](openai-quickstart.md)
|
|
105
|
-
- [Anthropic quickstart](anthropic-quickstart.md)
|
|
106
|
-
- [Gemini quickstart](gemini-quickstart.md)
|
|
236
|
+
It models “Read ticket TCK-100 and prepare a refund for its order.” Application code
|
|
237
|
+
searches each ready task once, carries the authorized order ID to its dependent task,
|
|
238
|
+
then prepares a preview requiring approval. Expect one mocked planning turn, four
|
|
239
|
+
ordinary-model turns, one read, one preparation and zero commits. The customer response
|
|
240
|
+
explains that approval is still pending. Dependencies and response assembly belong to
|
|
241
|
+
the example application, not a framework workflow engine.
|
|
242
|
+
|
|
243
|
+
## Connect your model and application
|
|
244
|
+
|
|
245
|
+
Keep the same task text and invocation context when passing a result-bound router to
|
|
246
|
+
your ordinary runner. Do not reconstruct, persist or reuse results across requests.
|
|
247
|
+
Permissions, controls, source changes, cancellation and expiry are rechecked before
|
|
248
|
+
export and execution. A retrieval score never authorizes an action.
|
|
249
|
+
|
|
250
|
+
Replace the mock with your configured Responses-compatible client and an explicit model
|
|
251
|
+
when using `runOpenAIResponses`; the framework supplies no account, credentials or model
|
|
252
|
+
default. Existing configured clients need no additional discovery model. The optional
|
|
253
|
+
OpenAI SDK is needed only if your application chooses it. See the
|
|
254
|
+
[OpenAI quickstart](openai-quickstart.md) or
|
|
255
|
+
[choose another runtime](../providers/choose-a-runtime.md).
|
|
256
|
+
|
|
257
|
+
For `no_match`, clarify; for `unavailable` or `cancelled`, handle the operational
|
|
258
|
+
outcome. Do not execute the first candidate automatically. Lexical/native is
|
|
259
|
+
recommended. [Dedicated selection](../discovery.md#optional-dedicated-selection) is
|
|
260
|
+
optional; hybrid is experimental with
|
|
261
|
+
[qualification limits](../evals/discovery-qualification.md).
|
|
262
|
+
|
|
263
|
+
The [stable workflow contract](../api/stable-workflow.md) defines compatibility for this
|
|
264
|
+
path. Production authentication, resource access checks and durable stores remain
|
|
265
|
+
host-owned. [Repository development](../development.md) is separate from package use.
|
|
@@ -1,32 +1,10 @@
|
|
|
1
1
|
# Quickstart
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
node examples/runtime-support-billing/run-mock.mjs
|
|
12
|
-
node dist/cli.js eval examples --results examples/eval-results/public.results.passing.json
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
Expected output excerpts:
|
|
16
|
-
|
|
17
|
-
```text
|
|
18
|
-
Validated 16 manifest(s) and 18 fixture(s).
|
|
19
|
-
Manifests: 16 (6 capabilities, 4 entities, 6 evals)
|
|
20
|
-
approval_required
|
|
21
|
-
Eval suite passed
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
What this proves:
|
|
25
|
-
|
|
26
|
-
- manifests and fixtures validate;
|
|
27
|
-
- read/prepare tools can be exported without exposing commit tools;
|
|
28
|
-
- the runtime can read, prepare, require approval, and commit through host lifecycle
|
|
29
|
-
APIs;
|
|
30
|
-
- evals prove expected behavior without calling a model.
|
|
31
|
-
|
|
32
|
-
Full command explanations are in [Start here](../start-here.md).
|
|
3
|
+
Start with the [installed-package walkthrough](provider-neutral-quickstart.md). From an
|
|
4
|
+
empty project it shows a complete manifest, registry loading, runtime context, handler,
|
|
5
|
+
lexical discovery and ordinary mocked tool execution. No checkout or provider key is
|
|
6
|
+
required.
|
|
7
|
+
|
|
8
|
+
The same guide runs the complete dependent read/prepare customer example and explains
|
|
9
|
+
approval requirements. See [repository development](../development.md) only when
|
|
10
|
+
changing the framework itself.
|
package/docs/index.md
CHANGED
|
@@ -73,3 +73,13 @@ Models propose; applications validate, authorize, execute, and audit.
|
|
|
73
73
|
- [Security disclosure](public-framework/security-disclosure.md)
|
|
74
74
|
- [API reference](api.md)
|
|
75
75
|
- [Public API policy](api/public-api-policy.md)
|
|
76
|
+
|
|
77
|
+
## Capability discovery
|
|
78
|
+
|
|
79
|
+
The optional `ai-capability-framework/discovery` API provides a
|
|
80
|
+
[stable lexical/native workflow](api/stable-workflow.md), a simple search facade,
|
|
81
|
+
result-bound routers, explicit hybrid retrieval and dedicated selection, and
|
|
82
|
+
provider-free evaluation. Start with [finding capabilities for a task](discovery.md).
|
|
83
|
+
For opt-in provider evaluation, see the
|
|
84
|
+
[discovery live evaluation guide](evals/discovery-live.md) and the
|
|
85
|
+
[qualification results and limits](evals/discovery-qualification.md).
|
package/docs/release.md
CHANGED
|
@@ -2,6 +2,29 @@
|
|
|
2
2
|
|
|
3
3
|
This checklist prepares an AICF public release for GitHub and npm distribution.
|
|
4
4
|
|
|
5
|
+
## Stable discovery workflow
|
|
6
|
+
|
|
7
|
+
The [named lexical/native workflow](api/stable-workflow.md) is stable public in 1.1.0.
|
|
8
|
+
Advanced APIs retain their individual maturity labels. Recommend lexical retrieval with
|
|
9
|
+
ordinary model tool selection; dedicated selection is optional and hybrid remains
|
|
10
|
+
experimental. Link the [qualification report](evals/discovery-qualification.md) in
|
|
11
|
+
release notes. Its qualified lexical results apply to a tested synthetic configuration,
|
|
12
|
+
and the revised workflow assessment is an offline checker correction rather than new
|
|
13
|
+
live trials.
|
|
14
|
+
|
|
15
|
+
Use a reviewed pull request, passing hosted Linux Node 20/22/24 checks, merge, and an
|
|
16
|
+
exact-commit manual release dry-run before pushing the matching version tag. Local
|
|
17
|
+
checks do not replace hosted checks. Prereleases publish both packages to `next`,
|
|
18
|
+
preserving `latest` for prereleases. Stable 1.1.0 publishes to `latest` while preserving
|
|
19
|
+
the existing `next` tag and prerelease versions. Verify normal installation as well as
|
|
20
|
+
exact-version registry installs.
|
|
21
|
+
|
|
22
|
+
The publication and dry-run workflows run `npm run check` plus certification with
|
|
23
|
+
`VITEST_MAX_WORKERS=2`. Publication is serialized; registry failures fail closed unless
|
|
24
|
+
npm explicitly reports E404 for an absent version. Local npm login is not the OIDC
|
|
25
|
+
publishing mechanism. Verify package ownership and the trusted publisher for both
|
|
26
|
+
packages before tagging; never substitute a stored npm token.
|
|
27
|
+
|
|
5
28
|
## Preflight
|
|
6
29
|
|
|
7
30
|
- Confirm the release branch contains only public framework material.
|
|
@@ -261,11 +284,12 @@ npm view "ai-capability-framework@${VERSION}" version
|
|
|
261
284
|
npm view "@aicf/agent-skills@${VERSION}" version
|
|
262
285
|
```
|
|
263
286
|
|
|
264
|
-
If only
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
version as a normal recovery
|
|
287
|
+
If only one package published, mark the release incomplete and inspect its registry
|
|
288
|
+
metadata before taking further action. The ordinary workflow rejects already-published
|
|
289
|
+
targets, so do not blindly rerun it. Use a new coordinated release candidate when the
|
|
290
|
+
existing workflow cannot safely complete the missing package. Do not move the public
|
|
291
|
+
tag, delete the published version, or reuse a published npm version as a normal recovery
|
|
292
|
+
path.
|
|
269
293
|
|
|
270
294
|
If the tagged code is wrong, or if the failed package cannot be safely published from
|
|
271
295
|
the same commit, bump both package versions and ship a follow-up patch or release
|
package/docs/runtime.md
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
# Runtime Contracts
|
|
2
2
|
|
|
3
|
+
The [named lexical/native workflow](api/stable-workflow.md) and its required runtime
|
|
4
|
+
members are stable public from 1.1.0. Other runtime APIs retain their existing maturity;
|
|
5
|
+
this does not promote every export. Start with the
|
|
6
|
+
[installed-package walkthrough](getting-started/provider-neutral-quickstart.md).
|
|
7
|
+
|
|
3
8
|
AICF Runtime is an additive TypeScript subpath for host applications that want
|
|
4
9
|
deterministic runtime context, capability routing, policy brokering, handler execution,
|
|
5
10
|
action lifecycle control, and model-safe tool result envelopes.
|
|
@@ -89,6 +94,12 @@ are incompatible with active read-only controls.
|
|
|
89
94
|
Use `formatCapabilitySliceForModel()` to render concise model-facing capability guidance
|
|
90
95
|
without private diagnostics, internal policy rules, or full output schemas.
|
|
91
96
|
|
|
97
|
+
`filterEligibleCapabilities(request)` exposes the same runtime eligibility filters
|
|
98
|
+
without ranking or count truncation. It returns `eligible` manifests in registry order
|
|
99
|
+
and `excluded` capability IDs with their existing reasons. The default router uses this
|
|
100
|
+
helper before scoring and applying its capability limit. Eligibility is a request-time
|
|
101
|
+
filter; normal execution authorization still applies.
|
|
102
|
+
|
|
92
103
|
## Policy Broker
|
|
93
104
|
|
|
94
105
|
`DefaultPolicyBroker` wraps the Core `decideCapability()` control plane and adds runtime
|
|
@@ -167,3 +178,19 @@ node examples/runtime-support-billing/run-mock.mjs
|
|
|
167
178
|
It loads the support manifests, routes read and prepare capabilities, executes a ticket
|
|
168
179
|
read, prepares a refund case that requires approval, records a host approval, and
|
|
169
180
|
commits only through `AicfActionLifecycleManager`.
|
|
181
|
+
|
|
182
|
+
### Optional shared provider runs
|
|
183
|
+
|
|
184
|
+
`createAicfProviderRun` joins explicitly managed application planning, discovery,
|
|
185
|
+
selection, and Responses tool-loop calls under one reservation ledger and absolute
|
|
186
|
+
deadline. Its immutable snapshots retain unknown usage, pending work, and unique
|
|
187
|
+
attempts. The default router and ordinary runner calls remain source-compatible. See the
|
|
188
|
+
[shared-run example](../examples/12-capability-discovery-selection/README.md#shared-run-integration)
|
|
189
|
+
for task-bound routing, optional selection, metadata tracing, and offline replay.
|
|
190
|
+
|
|
191
|
+
## Optional capability discovery
|
|
192
|
+
|
|
193
|
+
Use [capability discovery](discovery.md) to retrieve an eligible shortlist and pass its
|
|
194
|
+
result-bound router to an ordinary model/tool runner. The optional discovery subpath
|
|
195
|
+
preserves runtime authorization and read/prepare boundaries; default routing stays
|
|
196
|
+
unchanged. Dedicated model selection is explicitly invoked.
|
package/docs/start-here.md
CHANGED
|
@@ -1,136 +1,25 @@
|
|
|
1
1
|
# Start Here
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
runtime
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
```text
|
|
27
|
-
Validated 16 manifest(s) and 18 fixture(s).
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
This proves the public manifests and fixture files are parseable, schema-valid,
|
|
31
|
-
cross-referenced, and public-safe enough for the validation rules.
|
|
32
|
-
|
|
33
|
-
## 3. Inspect The Registry
|
|
34
|
-
|
|
35
|
-
Build the CLI, then inspect the examples:
|
|
36
|
-
|
|
37
|
-
```bash
|
|
38
|
-
npm run build
|
|
39
|
-
node dist/cli.js inspect examples
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
Expected excerpt:
|
|
43
|
-
|
|
44
|
-
```text
|
|
45
|
-
AICF Registry
|
|
46
|
-
Manifests: 16
|
|
47
|
-
Capabilities by type:
|
|
48
|
-
- read_data: scheduling.availability.get, support.ticket.get
|
|
49
|
-
- write_prepare_only: scheduling.invite.prepare, support.refund.prepare_case
|
|
50
|
-
- write_commit: scheduling.invite.send, support.refund.commit_case
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
This shows the validated registry AICF uses for routing, provider export, policy
|
|
54
|
-
decisions, and eval scoring.
|
|
55
|
-
|
|
56
|
-
## 4. Export OpenAI Tools
|
|
57
|
-
|
|
58
|
-
```bash
|
|
59
|
-
node dist/cli.js openai-tools examples --context examples/support/openai/context.support_agent.json
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
Expected excerpt:
|
|
63
|
-
|
|
64
|
-
```json
|
|
65
|
-
{
|
|
66
|
-
"tools": [
|
|
67
|
-
{
|
|
68
|
-
"type": "function",
|
|
69
|
-
"name": "aicf_support_refund_prepare_case",
|
|
70
|
-
"strict": true
|
|
71
|
-
},
|
|
72
|
-
{
|
|
73
|
-
"type": "function",
|
|
74
|
-
"name": "aicf_support_ticket_get",
|
|
75
|
-
"strict": true
|
|
76
|
-
}
|
|
77
|
-
],
|
|
78
|
-
"excluded": [
|
|
79
|
-
{
|
|
80
|
-
"capabilityId": "support.refund.commit_case"
|
|
81
|
-
}
|
|
82
|
-
]
|
|
83
|
-
}
|
|
84
|
-
```
|
|
85
|
-
|
|
86
|
-
This proves safe tool export. The model can see read and prepare tools, but the commit
|
|
87
|
-
capability is not exposed as a normal model tool.
|
|
88
|
-
|
|
89
|
-
## 5. Run The Mock Runtime Flow
|
|
90
|
-
|
|
91
|
-
```bash
|
|
92
|
-
node examples/runtime-support-billing/run-mock.mjs
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
Expected excerpt:
|
|
96
|
-
|
|
97
|
-
```json
|
|
98
|
-
{
|
|
99
|
-
"readStatus": "success",
|
|
100
|
-
"prepareStatus": "approval_required",
|
|
101
|
-
"commitStatus": "committed"
|
|
102
|
-
}
|
|
103
|
-
```
|
|
104
|
-
|
|
105
|
-
This runs route, read, prepare, approval, and lifecycle commit with mock handlers and
|
|
106
|
-
in-memory reference stores. The model-facing path still cannot commit. Commit happens
|
|
107
|
-
only after the host records approval and calls the lifecycle manager.
|
|
108
|
-
|
|
109
|
-
## 6. Run Deterministic Evals
|
|
110
|
-
|
|
111
|
-
```bash
|
|
112
|
-
node dist/cli.js eval examples --results examples/eval-results/public.results.passing.json
|
|
113
|
-
```
|
|
114
|
-
|
|
115
|
-
Expected excerpt:
|
|
116
|
-
|
|
117
|
-
```text
|
|
118
|
-
Eval suite passed: 6/6 passed.
|
|
119
|
-
```
|
|
120
|
-
|
|
121
|
-
This proves the candidate fixture matches the eval manifests for tool selection,
|
|
122
|
-
arguments, policy decisions, refusals, response text, and no unapproved commit
|
|
123
|
-
boundaries.
|
|
124
|
-
|
|
125
|
-
## What You Just Proved
|
|
126
|
-
|
|
127
|
-
- Public manifests validate and build a registry.
|
|
128
|
-
- OpenAI tool export is safe and does not expose commit tools by default.
|
|
129
|
-
- Provider SDK validation does not replace AICF validation.
|
|
130
|
-
- The runtime can execute read and prepare handlers with model-safe envelopes.
|
|
131
|
-
- Approval-required prepare pauses before side effects.
|
|
132
|
-
- Host-controlled lifecycle commit works after approval and idempotency checks.
|
|
133
|
-
- Evals score behavior without calling models.
|
|
134
|
-
|
|
135
|
-
Next, read the [OpenAI walkthrough](openai-walkthrough.md) for the same flow from the
|
|
136
|
-
model/tool-call perspective, then use the [glossary](glossary.md) for the main terms.
|
|
3
|
+
Install with `npm install ai-capability-framework`, then follow the
|
|
4
|
+
[complete installed-package quickstart](getting-started/provider-neutral-quickstart.md).
|
|
5
|
+
It needs no checkout, provider SDK or API key.
|
|
6
|
+
|
|
7
|
+
You will author one capability, load its registry, create runtime context, register a
|
|
8
|
+
handler, search a task and execute the ordinary mock model/tool loop. The packaged
|
|
9
|
+
customer example then shows an authorized read followed by an approval-required preview.
|
|
10
|
+
|
|
11
|
+
Lexical/native is the recommended [stable workflow](api/stable-workflow.md). Dedicated
|
|
12
|
+
selection is optional; hybrid remains experimental with
|
|
13
|
+
[qualification limits](evals/discovery-qualification.md). Applications own
|
|
14
|
+
decomposition, dependencies, arguments, authentication, resource access and customer
|
|
15
|
+
responses.
|
|
16
|
+
|
|
17
|
+
The model can see read and prepare tools, but the commit capability is not exposed.
|
|
18
|
+
Runtime validation, authorization and approval policy remain the authority for actions.
|
|
19
|
+
|
|
20
|
+
- [Installation](getting-started/installation.md)
|
|
21
|
+
- [Capability manifests](capability-manifests.md)
|
|
22
|
+
- [Choose a runtime](providers/choose-a-runtime.md)
|
|
23
|
+
- [Discovery details](discovery.md)
|
|
24
|
+
- [API policy](api/public-api-policy.md)
|
|
25
|
+
- [Repository development](development.md)
|