@redditech/agent-protocol 0.0.0-stage → 0.2.1
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 +95 -0
- package/LICENSE +21 -0
- package/README.md +394 -2
- package/dist/adl.d.ts +141 -0
- package/dist/adl.js +3601 -0
- package/dist/agent-stack-fixtures.d.ts +743 -0
- package/dist/agent-stack-fixtures.js +1554 -0
- package/dist/ai-catalog.d.ts +128 -0
- package/dist/ai-catalog.js +373 -0
- package/dist/attestation-reputation.d.ts +102 -0
- package/dist/attestation-reputation.js +279 -0
- package/dist/audd-rail-config.d.ts +102 -0
- package/dist/audd-rail-config.js +294 -0
- package/dist/browser-wallet-approval.d.ts +293 -0
- package/dist/browser-wallet-approval.js +1201 -0
- package/dist/discovery-source.d.ts +115 -0
- package/dist/discovery-source.js +251 -0
- package/dist/evidence-archive.d.ts +73 -0
- package/dist/evidence-archive.js +238 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.js +23 -0
- package/dist/mpp-tempo-receipt-shapes.d.ts +201 -0
- package/dist/mpp-tempo-receipt-shapes.js +330 -0
- package/dist/okf-adapter.d.ts +229 -0
- package/dist/okf-adapter.js +556 -0
- package/dist/okf-conformance.d.ts +208 -0
- package/dist/okf-conformance.js +651 -0
- package/dist/okf-instruction-safety.d.ts +192 -0
- package/dist/okf-instruction-safety.js +509 -0
- package/dist/onboarding-analyser-handoff.d.ts +391 -0
- package/dist/onboarding-analyser-handoff.js +959 -0
- package/dist/onboarding-state-machine.d.ts +228 -0
- package/dist/onboarding-state-machine.js +432 -0
- package/dist/payment-records.d.ts +181 -0
- package/dist/payment-records.js +599 -0
- package/dist/policy.d.ts +33 -0
- package/dist/policy.js +45 -0
- package/dist/provider-trust.d.ts +113 -0
- package/dist/provider-trust.js +346 -0
- package/dist/quasar-registry-compatibility.d.ts +113 -0
- package/dist/quasar-registry-compatibility.js +214 -0
- package/dist/ranking-explainability.d.ts +202 -0
- package/dist/ranking-explainability.js +302 -0
- package/dist/receipt-v2.d.ts +202 -0
- package/dist/receipt-v2.js +418 -0
- package/dist/repo-explorer-evidence-manifest.d.ts +387 -0
- package/dist/repo-explorer-evidence-manifest.js +1187 -0
- package/dist/source-diagnostics.d.ts +84 -0
- package/dist/source-diagnostics.js +193 -0
- package/dist/source-trust-conformance-matrix.d.ts +207 -0
- package/dist/source-trust-conformance-matrix.js +672 -0
- package/examples/ard-no-spend-ai-catalog.json +51 -0
- package/examples/ard-no-spend-demo.mjs +355 -0
- package/examples/interpretation-guide-scenarios.mjs +302 -0
- package/package.json +144 -4
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DRAFT v1 — SPIKE (#511, under epic #468; scope decision tracked in #513).
|
|
3
|
+
*
|
|
4
|
+
* A PURE, offline adapter that projects an OpenKB-style knowledge-bundle fixture
|
|
5
|
+
* into a strict OKF- (Open Knowledge Format) *shaped* output for RAP review.
|
|
6
|
+
*
|
|
7
|
+
* This module is PURE: no network, no filesystem read of the live bundle, no URL
|
|
8
|
+
* ingestion, no OpenKB install, no LLM/provider call, no script/tool execution,
|
|
9
|
+
* no skill generation/installation. It only re-shapes an in-memory fixture that
|
|
10
|
+
* the caller already holds.
|
|
11
|
+
*
|
|
12
|
+
* ─────────────────────────────────────────────────────────────────────────────
|
|
13
|
+
* IMPORTANT — DRAFT / UNVERIFIED: OKF is an EXTERNAL Google format
|
|
14
|
+
* (GoogleCloudPlatform/knowledge-catalog `okf/SPEC.md`). EVERY OKF field name and
|
|
15
|
+
* shape below is illustrative and LOW/MEDIUM confidence. Each externally-named
|
|
16
|
+
* OKF field is tagged `(DRAFT/unverified — OKF, confirm field)`. Do NOT treat any
|
|
17
|
+
* of these as authoritative OKF field names, and do NOT rely on this projection
|
|
18
|
+
* for a real OKF import/export without reconciling against the live spec first.
|
|
19
|
+
* ─────────────────────────────────────────────────────────────────────────────
|
|
20
|
+
*
|
|
21
|
+
* Security posture (mirrors the epic boundaries):
|
|
22
|
+
* - Generated `AGENTS.md`, `SKILL.md`, prompts, scripts, tools, and agent
|
|
23
|
+
* definitions are classified UNTRUSTED review artifacts — never trusted policy
|
|
24
|
+
* or runtime metadata, never executed, never installed.
|
|
25
|
+
* - Unknown frontmatter fields are permissively PRESERVED but explicitly marked
|
|
26
|
+
* untrusted (not policy/runtime configuration).
|
|
27
|
+
* - Instructions embedded in bundle content are DATA, never followed.
|
|
28
|
+
* - Fail-closed on malformed input and on any request to execute/install/ingest.
|
|
29
|
+
*/
|
|
30
|
+
export declare const OKF_ADAPTER_SCHEMA_VERSION: "reddi.okf-adapter.v1";
|
|
31
|
+
/** Top-level draft flag — the whole schema is unverified against the live OKF spec. */
|
|
32
|
+
export declare const OKF_ADAPTER_IS_DRAFT: true;
|
|
33
|
+
/**
|
|
34
|
+
* Illustrative OKF format version emitted on the shaped bundle.
|
|
35
|
+
* (DRAFT/unverified — OKF, confirm field.)
|
|
36
|
+
*/
|
|
37
|
+
export declare const OKF_ADAPTER_ILLUSTRATIVE_OKF_VERSION: "0.1-illustrative";
|
|
38
|
+
export type OkfDocumentRole = 'index' | 'log' | 'concept' | 'instruction_artifact' | 'unknown';
|
|
39
|
+
export type OkfTrustClassification = 'static_source' | 'untrusted_generated_instruction';
|
|
40
|
+
export type OkfAdapterReasonCode = 'okf_adapter_ok' | 'bundle_malformed' | 'document_malformed' | 'unsupported_link_syntax' | 'malformed_frontmatter' | 'missing_provenance' | 'generated_instruction_untrusted' | 'execution_not_allowed' | 'concept_type_missing' | 'unknown_frontmatter_preserved' | 'operation_not_permitted';
|
|
41
|
+
export type OkfDiagnosticLane = 'bundle' | 'document_role' | 'link' | 'frontmatter' | 'provenance' | 'instruction_safety';
|
|
42
|
+
export type OkfDiagnosticSeverity = 'info' | 'warning' | 'blocked';
|
|
43
|
+
export type OkfDiagnostic = {
|
|
44
|
+
lane: OkfDiagnosticLane;
|
|
45
|
+
severity: OkfDiagnosticSeverity;
|
|
46
|
+
code: OkfAdapterReasonCode;
|
|
47
|
+
/** Document id the diagnostic is scoped to, when document-scoped. */
|
|
48
|
+
documentId?: string;
|
|
49
|
+
summary: string;
|
|
50
|
+
action?: string;
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* A standard-markdown link in the OKF-shaped body.
|
|
54
|
+
* (DRAFT/unverified — OKF, confirm field: OKF link representation.)
|
|
55
|
+
*/
|
|
56
|
+
export type OkfLink = {
|
|
57
|
+
/** Visible link text. */
|
|
58
|
+
text: string;
|
|
59
|
+
/** Normalized standard-markdown link target (e.g. `Agent.md`). */
|
|
60
|
+
target: string;
|
|
61
|
+
/** Whether this link was converted from an OpenKB `[[wikilink]]` or was already markdown. */
|
|
62
|
+
origin: 'wikilink' | 'markdown';
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* Source provenance for an OKF document.
|
|
66
|
+
* (DRAFT/unverified — OKF, confirm field: OKF provenance / source refs shape.)
|
|
67
|
+
*/
|
|
68
|
+
export type OkfProvenance = {
|
|
69
|
+
/** Source URI the document was derived from (recorded, never fetched). */
|
|
70
|
+
sourceUri?: string;
|
|
71
|
+
/** Upstream source commit for reproducibility. */
|
|
72
|
+
sourceCommit?: string;
|
|
73
|
+
/** When the source was captured (recorded string, not validated). */
|
|
74
|
+
retrievedAt?: string;
|
|
75
|
+
};
|
|
76
|
+
export type OkfDocument = {
|
|
77
|
+
/**
|
|
78
|
+
* Stable document id/path within the OKF bundle.
|
|
79
|
+
* (DRAFT/unverified — OKF, confirm field: OKF document id/path convention.)
|
|
80
|
+
*/
|
|
81
|
+
id: string;
|
|
82
|
+
/**
|
|
83
|
+
* OKF document role. `index`/`log` are normalized special files; `concept` is a
|
|
84
|
+
* concept document (requires a non-empty `type`); `instruction_artifact` is an
|
|
85
|
+
* UNTRUSTED generated artifact; `unknown` is anything else.
|
|
86
|
+
* (DRAFT/unverified — OKF, confirm field: OKF document-role vocabulary.)
|
|
87
|
+
*/
|
|
88
|
+
documentRole: OkfDocumentRole;
|
|
89
|
+
/**
|
|
90
|
+
* `type` frontmatter for concept documents (non-empty required by OKF); null
|
|
91
|
+
* when absent or when the document is not a concept.
|
|
92
|
+
* (DRAFT/unverified — OKF, confirm field: OKF concept `type`.)
|
|
93
|
+
*/
|
|
94
|
+
type: string | null;
|
|
95
|
+
/**
|
|
96
|
+
* Title from frontmatter `title` or the first `#` heading; null if neither.
|
|
97
|
+
* (DRAFT/unverified — OKF, confirm field: OKF `title`.)
|
|
98
|
+
*/
|
|
99
|
+
title: string | null;
|
|
100
|
+
/**
|
|
101
|
+
* Frontmatter with unknown fields permissively PRESERVED. RAP treats this as
|
|
102
|
+
* UNTRUSTED review metadata — never policy/runtime configuration.
|
|
103
|
+
* (DRAFT/unverified — OKF, confirm field: OKF frontmatter contract.)
|
|
104
|
+
*/
|
|
105
|
+
frontmatter: Record<string, unknown>;
|
|
106
|
+
/** Markdown body with `[[wikilinks]]` converted to standard markdown links where deterministic. */
|
|
107
|
+
body: string;
|
|
108
|
+
/**
|
|
109
|
+
* Standard-markdown links extracted from the body (converted + native).
|
|
110
|
+
* (DRAFT/unverified — OKF, confirm field: OKF link representation.)
|
|
111
|
+
*/
|
|
112
|
+
links: OkfLink[];
|
|
113
|
+
/**
|
|
114
|
+
* Source provenance (recorded only; never fetched).
|
|
115
|
+
* (DRAFT/unverified — OKF, confirm field: OKF provenance / source refs shape.)
|
|
116
|
+
*/
|
|
117
|
+
provenance: OkfProvenance | null;
|
|
118
|
+
/**
|
|
119
|
+
* RAP trust classification — NOT an OKF field. Generated instruction artifacts
|
|
120
|
+
* are `untrusted_generated_instruction`; everything else is `static_source`.
|
|
121
|
+
*/
|
|
122
|
+
trustClassification: OkfTrustClassification;
|
|
123
|
+
/** Per-document diagnostics. */
|
|
124
|
+
diagnostics: OkfDiagnostic[];
|
|
125
|
+
};
|
|
126
|
+
/**
|
|
127
|
+
* Normalized `index.md` semantics.
|
|
128
|
+
* (DRAFT/unverified — OKF, confirm field: OKF index/table-of-contents shape.)
|
|
129
|
+
*/
|
|
130
|
+
export type OkfIndex = {
|
|
131
|
+
documentId: string;
|
|
132
|
+
entries: Array<{
|
|
133
|
+
text: string;
|
|
134
|
+
target: string;
|
|
135
|
+
}>;
|
|
136
|
+
summary: string;
|
|
137
|
+
};
|
|
138
|
+
/**
|
|
139
|
+
* Normalized `log.md` semantics (append-only change log — recorded, not trusted).
|
|
140
|
+
* (DRAFT/unverified — OKF, confirm field: OKF log/changelog shape.)
|
|
141
|
+
*/
|
|
142
|
+
export type OkfLog = {
|
|
143
|
+
documentId: string;
|
|
144
|
+
entryCount: number;
|
|
145
|
+
summary: string;
|
|
146
|
+
};
|
|
147
|
+
export type OkfAdapterBundle = {
|
|
148
|
+
schemaVersion: typeof OKF_ADAPTER_SCHEMA_VERSION;
|
|
149
|
+
/** The whole schema is a draft projection against an unverified external format. */
|
|
150
|
+
draft: true;
|
|
151
|
+
/**
|
|
152
|
+
* Illustrative OKF format version.
|
|
153
|
+
* (DRAFT/unverified — OKF, confirm field: OKF format/version marker.)
|
|
154
|
+
*/
|
|
155
|
+
okfVersion: string;
|
|
156
|
+
adapterIntent: 'okf_shaped' | 'blocked';
|
|
157
|
+
bundleId: string | null;
|
|
158
|
+
documents: OkfDocument[];
|
|
159
|
+
index: OkfIndex | null;
|
|
160
|
+
log: OkfLog | null;
|
|
161
|
+
/** Bundle-level + aggregated document diagnostics. */
|
|
162
|
+
diagnostics: OkfDiagnostic[];
|
|
163
|
+
reasonCodes: OkfAdapterReasonCode[];
|
|
164
|
+
/**
|
|
165
|
+
* Hard-coded false guardrails — this adapter never touches any live rail.
|
|
166
|
+
* Asserting these lets tests prove nothing implies a fetch/exec/install.
|
|
167
|
+
*/
|
|
168
|
+
guardrails: {
|
|
169
|
+
network: false;
|
|
170
|
+
fileSystemReadOfBundle: false;
|
|
171
|
+
executed: false;
|
|
172
|
+
installed: false;
|
|
173
|
+
urlIngested: false;
|
|
174
|
+
llmInvoked: false;
|
|
175
|
+
skillGenerated: false;
|
|
176
|
+
instructionsTrusted: false;
|
|
177
|
+
};
|
|
178
|
+
notes: string[];
|
|
179
|
+
};
|
|
180
|
+
export type OkfAdapterOptions = {
|
|
181
|
+
/** Emit `missing_provenance` at `blocked` severity instead of `warning`. */
|
|
182
|
+
requireProvenance?: boolean;
|
|
183
|
+
/**
|
|
184
|
+
* FAIL-CLOSED: any attempt to actually execute, install, ingest a URL, invoke an
|
|
185
|
+
* LLM, or generate/register a skill is rejected with `operation_not_permitted`.
|
|
186
|
+
* This module never performs any of these — the flags exist only to reject them.
|
|
187
|
+
*/
|
|
188
|
+
execute?: boolean;
|
|
189
|
+
install?: boolean;
|
|
190
|
+
ingestUrl?: boolean;
|
|
191
|
+
invokeLlm?: boolean;
|
|
192
|
+
generateSkill?: boolean;
|
|
193
|
+
};
|
|
194
|
+
/** Input document — an OpenKB-style markdown/frontmatter file (already in memory). */
|
|
195
|
+
export type OpenKbDocumentInput = {
|
|
196
|
+
/** Bundle-relative path, e.g. `concepts/agent.md`, `index.md`, `AGENTS.md`. */
|
|
197
|
+
path: string;
|
|
198
|
+
/**
|
|
199
|
+
* Already-parsed frontmatter object (preferred). Unknown fields are preserved.
|
|
200
|
+
* If provided as a non-object, a `malformed_frontmatter` diagnostic is raised.
|
|
201
|
+
*/
|
|
202
|
+
frontmatter?: unknown;
|
|
203
|
+
/**
|
|
204
|
+
* Optional raw flat-frontmatter string (`key: value` lines). Parsed conservatively;
|
|
205
|
+
* lines that are neither blank nor `key: value` raise `malformed_frontmatter`.
|
|
206
|
+
* Ignored when `frontmatter` is an object.
|
|
207
|
+
*/
|
|
208
|
+
rawFrontmatter?: string;
|
|
209
|
+
/** Markdown body, possibly containing OpenKB `[[wikilinks]]`. */
|
|
210
|
+
body?: string;
|
|
211
|
+
/** Source provenance (recorded only). */
|
|
212
|
+
provenance?: OkfProvenance;
|
|
213
|
+
};
|
|
214
|
+
/** Input bundle — a set of OpenKB-style documents. */
|
|
215
|
+
export type OpenKbBundleInput = {
|
|
216
|
+
bundleId?: string;
|
|
217
|
+
documents: OpenKbDocumentInput[];
|
|
218
|
+
};
|
|
219
|
+
/**
|
|
220
|
+
* Pure, offline projection of an OpenKB-style bundle fixture into an OKF-shaped
|
|
221
|
+
* output. Never fetches, executes, installs, ingests URLs, invokes an LLM, or
|
|
222
|
+
* generates a skill. Fails closed on malformed input and on any such request.
|
|
223
|
+
*/
|
|
224
|
+
export declare function adaptOpenKbBundleToOkf(input: unknown, options?: OkfAdapterOptions): OkfAdapterBundle;
|
|
225
|
+
/**
|
|
226
|
+
* Canonical OpenKB-style bundle fixture (in-memory, offline). Illustrative only —
|
|
227
|
+
* the frontmatter/body content is DATA and must never be treated as instructions.
|
|
228
|
+
*/
|
|
229
|
+
export declare const openKbBundleFixtures: Record<string, OpenKbBundleInput>;
|