@passioncode-ai/fabric-agent-adapter 0.24.0 → 0.26.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 +71 -1
- package/README.md +1 -1
- package/package.json +1 -1
- package/plugins/fabric-agent-adapter/.claude-plugin/plugin.json +1 -1
- package/plugins/fabric-agent-adapter/skills/adapting-projects-to-fabric/SKILL.md +3 -3
- package/plugins/fabric-agent-adapter/skills/adapting-projects-to-fabric/scripts/adapt_project.py +17 -5
- package/plugins/fabric-agent-adapter/skills/adapting-projects-to-fabric/scripts/fabric_identifiers.py +182 -0
- package/plugins/fabric-agent-adapter/skills/adapting-projects-to-fabric/scripts/fabric_provider.py +7 -2
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/SKILL.md +2 -2
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/references/protocol.md +32 -2
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/scripts/check_service.py +10 -0
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/scripts/fabric-estate.mjs +8 -4
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/scripts/fabric-identifiers.mjs +156 -0
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/scripts/fabric-profiles.mjs +9 -6
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/scripts/fabric-service.mjs +128 -3
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/scripts/fabric_estate.py +11 -4
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/scripts/fabric_identifiers.py +182 -0
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/scripts/fabric_profiles.py +11 -6
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/scripts/fabric_service.py +176 -3
- package/plugins/fabric-agent-adapter/skills/creating-fabric-agents/SKILL.md +3 -3
- package/plugins/fabric-agent-adapter/skills/working-with-fabric/SKILL.md +1 -1
- package/plugins/fabric-agent-adapter/skills/working-with-fabric/scripts/fabric_session.py +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,75 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.26.0 - 2026-10-13
|
|
4
|
+
|
|
5
|
+
Feed events carry machine-readable `data` (contract DEC-0070, FAA-35), and a service says which protocol revisions it
|
|
6
|
+
accepts (DEC-0067, FAA-37). Both are in the pin `a046f57`, which does not move.
|
|
7
|
+
|
|
8
|
+
### Added
|
|
9
|
+
|
|
10
|
+
- **`data` on an event.**
|
|
11
|
+
- `make_event` / `makeEvent` and `JsonlEventLog.append` take `data={schema, value}`.
|
|
12
|
+
- `schema` is the absolute URI of a payload schema the service publishes.
|
|
13
|
+
- `value` holds at most 32 members. Each is a scalar (a string of at most 500 characters), a list of at most 32
|
|
14
|
+
scalars, or an object of at most 32 scalar members.
|
|
15
|
+
- FAC-SEM-101 refuses a string under a credential's name or of a credential's shape, at either level. The refusal names
|
|
16
|
+
the place, never the value.
|
|
17
|
+
- `feed_data_findings` / `feedDataFindings` and `feed_data_problems` / `feedDataProblems`.
|
|
18
|
+
- **Protocol revisions.**
|
|
19
|
+
- `PROTOCOL_REVISIONS` (the contract's register), `parse_revision`, `accepted_revisions` (N and N−1),
|
|
20
|
+
`negotiate_revision` / `negotiateRevision` (`schema-unsupported`, or the receiver's own `no-accepted-revisions`) and
|
|
21
|
+
`protocols_findings` / `protocolsFindings` (FAC-SEM-099).
|
|
22
|
+
- `build_well_known` / `buildWellKnown` take `protocols`. List them only once your hosts are pinned at or after
|
|
23
|
+
DEC-0067, because the document is closed for an older reader.
|
|
24
|
+
- **`check_service.py`** reads `well-known.protocols` and `events.data`.
|
|
25
|
+
|
|
26
|
+
### Evidence
|
|
27
|
+
|
|
28
|
+
Every case below is answered by the contract's own functions at `a046f57` (`vendor_vectors.mjs`):
|
|
29
|
+
- the 7 `negotiateRevision` cases and the register;
|
|
30
|
+
- FAC-SEM-099 over 14 lists;
|
|
31
|
+
- every events-page and well-known-protocols fixture as the catalogue lists it;
|
|
32
|
+
- FAC-SEM-101 over 10 pages.
|
|
33
|
+
|
|
34
|
+
N and N−1 cannot occur at this pin, because each protocol has one revision. That rule is held on a register with three
|
|
35
|
+
revisions. 20 planted defects were all caught. The scenario eval `feed-data-and-protocols` was written before the prose.
|
|
36
|
+
|
|
37
|
+
## 0.25.0 - 2026-10-13
|
|
38
|
+
|
|
39
|
+
Identifier equality by normal form (contract DEC-0076) in both kits, and the contract pin moves from `fe55fc6` to
|
|
40
|
+
contract `main` `a046f57` (FAA-39). `fe55fc6` joins the supported revisions. DEC-0077 (`com.directory` pages) is in the
|
|
41
|
+
pin. Its consumer is the kits' board client, which is not built yet (FAA-12b), so nothing reads it.
|
|
42
|
+
|
|
43
|
+
### Added
|
|
44
|
+
|
|
45
|
+
- **`normal_identifier` / `normalIdentifier` and `same_identifier` / `sameIdentifier`** (`fabric_identifiers.py`,
|
|
46
|
+
byte-identical in both skills, and `fabric-identifiers.mjs`). They port the contract's `src/identifiers.ts` and are
|
|
47
|
+
held to its `identifiers.json` (33 normal forms, 8 same, 8 different, 6 lax-port mistakes).
|
|
48
|
+
- A URI follows RFC 3986 §6.2.2.
|
|
49
|
+
- A `urn:` follows RFC 8141 §3.1 (the NSS's case is kept and nothing is decoded).
|
|
50
|
+
- Any other string is its own normal form.
|
|
51
|
+
|
|
52
|
+
### Changed
|
|
53
|
+
|
|
54
|
+
- **Compared by normal form:**
|
|
55
|
+
- FAC-SEM-030, FAC-SEM-032 and FAC-SEM-034 compare a revision reference's id and the project and capability of
|
|
56
|
+
admissions, bindings and events;
|
|
57
|
+
- FAC-SEM-076 compares share grants and `grant` revocations;
|
|
58
|
+
- FAC-SEM-014 compares a provider entry's `providerId`.
|
|
59
|
+
|
|
60
|
+
Two spellings of one identifier now read as one, and two identifiers stay two.
|
|
61
|
+
- **Written in normal form:** the scaffolded `provider.id`, `identity.subject` and capability `id`, and the `providerId`
|
|
62
|
+
that `write_provider_entry` stores.
|
|
63
|
+
|
|
64
|
+
### Evidence
|
|
65
|
+
|
|
66
|
+
- The route and estate generators now add respelled-id cases (`urn` and the NID upper-cased, and the NSS's case
|
|
67
|
+
changed), each answered by the contract's own functions. The contract's fixtures are in normal form, so without these
|
|
68
|
+
cases the kits' byte comparisons stayed green.
|
|
69
|
+
- The compiled-schema revision tests pass at `2ce3922` → `a046f57`.
|
|
70
|
+
- 20 planted defects, all caught.
|
|
71
|
+
- The scenario eval `identifiers-by-normal-form` was written before the prose.
|
|
72
|
+
|
|
3
73
|
## 0.24.0 - 2026-10-13
|
|
4
74
|
|
|
5
75
|
An app's own descriptor (contract DEC-0069) and the descriptor for listings (DEC-0061) in both kits (FAA-34). The contract
|
|
@@ -675,7 +745,7 @@ DEC-0020 and DEC-0019 revisions stay valid.
|
|
|
675
745
|
code and reads the declared `minWidth`. Without Playwright every rule is `NOT_RUN`. It measures a settled
|
|
676
746
|
page: after the load it waits for the page's own requests to finish, and at each width for two frames,
|
|
677
747
|
250 ms and two more frames, so a header that grows when its data arrives is not measured between its new
|
|
678
|
-
size and the kit's reaction to it (seen once on
|
|
748
|
+
size and the kit's reaction to it (seen once on an adopting service's dashboard at 360 px: a false ED-5).
|
|
679
749
|
- **`check_service.py` rule `dashboard.declared`** (ED-9): PASS for a valid declaration (and names a newer
|
|
680
750
|
kit), FAIL for an invalid one, NOT_RUN for no dashboard or a legacy one.
|
|
681
751
|
- **`dashboard_extension()` / `dashboardExtension()`** in both kits, and `extensions` in `build_well_known` /
|
package/README.md
CHANGED
|
@@ -235,7 +235,7 @@ Scaffolding is non-destructive by default. It writes only the paths declared in
|
|
|
235
235
|
The default pin for new bundles is [`fabric-contract.lock.json`](fabric-contract.lock.json):
|
|
236
236
|
|
|
237
237
|
- version: `0.1.0`
|
|
238
|
-
- commit: `
|
|
238
|
+
- commit: `a046f57cf46ea9e3da57ff8ce6a3ed4d26d8774b`
|
|
239
239
|
|
|
240
240
|
Every other mention of the default contract revision — this section, the skills' metadata, the
|
|
241
241
|
skill card, `adapt_project.py` — must equal it; `python3 test/validate.py` fails a tree
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@passioncode-ai/fabric-agent-adapter",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.26.0",
|
|
4
4
|
"description": "Create Fabric-compatible agents, run them as always-alive local services with dashboards (fabric-service/0.1), and adapt existing projects to the Fabric Agent Contract. This package is the installer CLI.",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "python3 test/validate.py && python3 -m unittest discover -s test -q && node --test 'test/*.test.mjs'"
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"name": "fabric-agent-adapter",
|
|
4
4
|
"displayName": "Fabric Agent Adapter",
|
|
5
5
|
"description": "Create new Fabric-compatible agents, build them as always-alive local services with dashboards (fabric-service/0.1), and adapt existing projects to the Fabric Agent Contract through evidence-backed MCP, A2A, or local-runner provider bundles; and teach a coding agent to work in a project through Fabric (fabric-mcp, fabric_whoami, claim and release), with Claude Code session hooks.",
|
|
6
|
-
"version": "0.
|
|
6
|
+
"version": "0.26.0",
|
|
7
7
|
"author": {
|
|
8
8
|
"name": "PassionCode.ai",
|
|
9
9
|
"url": "https://passioncode.ai/"
|
|
@@ -5,9 +5,9 @@ license: AGPL-3.0-only OR LicenseRef-PassionCode-Commercial
|
|
|
5
5
|
compatibility: Requires filesystem access and Python 3.9+. Exact schema checks additionally need git, Node.js, pnpm, and the pinned fabric-agent-contract checkout (a public repository). Works without those tools in an explicitly degraded structural-check mode.
|
|
6
6
|
metadata:
|
|
7
7
|
author: PassionCode.ai
|
|
8
|
-
version: "0.
|
|
8
|
+
version: "0.26.0"
|
|
9
9
|
contract-version: "0.1.0"
|
|
10
|
-
contract-commit: "
|
|
10
|
+
contract-commit: "a046f57cf46ea9e3da57ff8ce6a3ed4d26d8774b"
|
|
11
11
|
---
|
|
12
12
|
|
|
13
13
|
# Adapting projects to Fabric
|
|
@@ -70,7 +70,7 @@ Use exactly:
|
|
|
70
70
|
|
|
71
71
|
- contract version `0.1.0`;
|
|
72
72
|
- repository `https://github.com/passioncode-ai/fabric-agent-contract`;
|
|
73
|
-
- commit `
|
|
73
|
+
- commit `a046f57cf46ea9e3da57ff8ce6a3ed4d26d8774b`.
|
|
74
74
|
|
|
75
75
|
This is the default for new bundles. When checking an issued legacy bundle, preserve its
|
|
76
76
|
explicit supported lock and use that exact clean checkout. Never silently upgrade or
|
package/plugins/fabric-agent-adapter/skills/adapting-projects-to-fabric/scripts/adapt_project.py
CHANGED
|
@@ -21,10 +21,10 @@ import fabric_secrets as _secrets # noqa: E402 - the contract's credential dete
|
|
|
21
21
|
|
|
22
22
|
CONTRACT_VERSION = "0.1.0"
|
|
23
23
|
CONTRACT_REPOSITORY = "https://github.com/passioncode-ai/fabric-agent-contract"
|
|
24
|
-
CONTRACT_COMMIT = "
|
|
24
|
+
CONTRACT_COMMIT = "a046f57cf46ea9e3da57ff8ce6a3ed4d26d8774b"
|
|
25
25
|
# #region supported-contract-revisions — docs: README.md#contract-pin
|
|
26
26
|
# Only this declaration may name a legacy revision in live files.
|
|
27
|
-
SUPPORTED_CONTRACT_COMMITS = (CONTRACT_COMMIT, "b291bf09e0a9f9fd3c16cf540832cd021203b7d1", "0cacd08b0e95b6abf131eae1206b60792138bc3c", "2eb91c00e852d9c31d804310d38fad91589fcbac", "8e49fbd5fbbf230e32c1969cd24ac3c22422f0a5", "a83bec6b47776af688402c18efec507143061f68", "52da526d7cc1e063d74c5b520dbc03d0ace15246", "78b2da018d2c4bd9ac1bde1dc3b7f1a110a175f5", "623bf61358c339cb10297807b3f024b5d9f1f327", "23f9fda4c05f8a3852246ee98d4f2adf74ed0875", "9091d3d6606b0c4b5591a38c3674356a01fd7f55", "df55c8c54a23251342a7ee57ba95642b7eb39e61", "2ce392291c6668598d12cd38327e24696b5ca15c")
|
|
27
|
+
SUPPORTED_CONTRACT_COMMITS = (CONTRACT_COMMIT, "fe55fc67cba1a9e34a736da7d148d4fe2a8fbfa0", "b291bf09e0a9f9fd3c16cf540832cd021203b7d1", "0cacd08b0e95b6abf131eae1206b60792138bc3c", "2eb91c00e852d9c31d804310d38fad91589fcbac", "8e49fbd5fbbf230e32c1969cd24ac3c22422f0a5", "a83bec6b47776af688402c18efec507143061f68", "52da526d7cc1e063d74c5b520dbc03d0ace15246", "78b2da018d2c4bd9ac1bde1dc3b7f1a110a175f5", "623bf61358c339cb10297807b3f024b5d9f1f327", "23f9fda4c05f8a3852246ee98d4f2adf74ed0875", "9091d3d6606b0c4b5591a38c3674356a01fd7f55", "df55c8c54a23251342a7ee57ba95642b7eb39e61", "2ce392291c6668598d12cd38327e24696b5ca15c")
|
|
28
28
|
# #endregion supported-contract-revisions
|
|
29
29
|
INTEROP_KEY = "https://fabric.passioncode.ai/agent-contract/extensions/interop/0.1"
|
|
30
30
|
MCP_REVISION = "2026-07-28"
|
|
@@ -47,6 +47,15 @@ class AdaptationError(Exception):
|
|
|
47
47
|
"""Expected user-facing adaptation error."""
|
|
48
48
|
|
|
49
49
|
|
|
50
|
+
|
|
51
|
+
def _normal_identifier(value: str) -> str:
|
|
52
|
+
"""DEC-0076's normal form, from fabric_identifiers.py beside this file (byte-identical to the service kit's)."""
|
|
53
|
+
import importlib.util
|
|
54
|
+
spec = importlib.util.spec_from_file_location("fabric_identifiers", Path(__file__).resolve().parent / "fabric_identifiers.py")
|
|
55
|
+
module = importlib.util.module_from_spec(spec)
|
|
56
|
+
spec.loader.exec_module(module)
|
|
57
|
+
return module.normal_identifier(value)
|
|
58
|
+
|
|
50
59
|
def _read_text(path: Path, limit: int = 262_144) -> str:
|
|
51
60
|
try:
|
|
52
61
|
if path.stat().st_size > limit:
|
|
@@ -237,24 +246,27 @@ def _generated_files(args: argparse.Namespace) -> Dict[str, str]:
|
|
|
237
246
|
raise AdaptationError("a runtime argument carries a credential; argv is visible to every process (LC-21): read it from a secret reference instead")
|
|
238
247
|
|
|
239
248
|
created_at = dt.datetime.now(dt.timezone.utc).replace(microsecond=0).isoformat().replace("+00:00", "Z")
|
|
249
|
+
# DEC-0076: a writer emits identifiers in their normal form, so every reader finds them under one spelling.
|
|
250
|
+
provider_id = _normal_identifier(args.provider_id)
|
|
251
|
+
capability_id = _normal_identifier(args.capability_id)
|
|
240
252
|
manifest = {
|
|
241
253
|
"contractVersion": CONTRACT_VERSION,
|
|
242
254
|
"provider": {
|
|
243
|
-
"id":
|
|
255
|
+
"id": provider_id,
|
|
244
256
|
"revision": 1,
|
|
245
257
|
"contentHash": "sha256:" + ("0" * 64),
|
|
246
258
|
"createdAt": created_at,
|
|
247
259
|
"createdBy": "urn:fabric:adapter:author",
|
|
248
260
|
"name": args.provider_name,
|
|
249
261
|
"identity": {
|
|
250
|
-
"subject":
|
|
262
|
+
"subject": provider_id,
|
|
251
263
|
"method": "local-install" if args.profile == "local-runner" or (args.profile == "mcp" and args.mcp_mode == "stdio") else "tls",
|
|
252
264
|
},
|
|
253
265
|
"supportedContractVersions": [CONTRACT_VERSION],
|
|
254
266
|
},
|
|
255
267
|
"capabilities": [
|
|
256
268
|
{
|
|
257
|
-
"id":
|
|
269
|
+
"id": capability_id,
|
|
258
270
|
"name": args.capability_name,
|
|
259
271
|
"inputSchema": _schema_uri(args.schema_base, "schemas/capability-input.schema.json"),
|
|
260
272
|
"outputSchema": _schema_uri(args.schema_base, "schemas/capability-output.schema.json"),
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
"""Identifier equality (contract DEC-0076): two identifiers are the same when their normal forms are equal.
|
|
2
|
+
|
|
3
|
+
A port of the contract's `src/identifiers.ts`, held to its `fixtures/vectors/identifiers.json`. The normal form of a URI
|
|
4
|
+
is RFC 3986 §6.2.2 syntax-based normalization: the scheme and the host lower-cased and percent-encoding hex upper-cased
|
|
5
|
+
(§6.2.2.1), percent-encoded unreserved characters decoded (§6.2.2.2), dot segments removed from a hierarchical path
|
|
6
|
+
(§6.2.2.3), and only the leading ones from a rootless path; nothing scheme-based (§6.2.3). A `urn:` URI follows RFC 8141
|
|
7
|
+
§3.1 instead: the scheme and the NID lower-cased, percent-encoding hex upper-cased, nothing decoded, the NSS's case kept,
|
|
8
|
+
the r-, q- and f-components ignored. A string that is not a URI by RFC 3986's `URI` production is its own normal form.
|
|
9
|
+
Nothing here raises. Standard library only; this file is byte-identical in both skills' `scripts/`."""
|
|
10
|
+
from __future__ import annotations
|
|
11
|
+
|
|
12
|
+
import re
|
|
13
|
+
from typing import Any, Optional, Tuple
|
|
14
|
+
|
|
15
|
+
_UNRESERVED = r"A-Za-z0-9\-._~"
|
|
16
|
+
_SUB_DELIMS = r"!$&'()*+,;="
|
|
17
|
+
_PCT = r"%[0-9A-Fa-f]{2}"
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def _run(chars: str) -> "re.Pattern[str]":
|
|
21
|
+
"""`*( <chars> / pct-encoded )`, linear: one character class beside one fixed triplet."""
|
|
22
|
+
return re.compile(r"(?:[%s]|%s)*" % (chars, _PCT), re.ASCII)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
_USERINFO = _run(_UNRESERVED + _SUB_DELIMS + ":")
|
|
26
|
+
_REG_NAME = _run(_UNRESERVED + _SUB_DELIMS)
|
|
27
|
+
_PATH = _run(_UNRESERVED + _SUB_DELIMS + ":@/")
|
|
28
|
+
_QUERY = _run(_UNRESERVED + _SUB_DELIMS + ":@/?")
|
|
29
|
+
_PORT = re.compile(r"[0-9]*", re.ASCII)
|
|
30
|
+
_SCHEME = re.compile(r"[A-Za-z][A-Za-z0-9+.-]*", re.ASCII)
|
|
31
|
+
|
|
32
|
+
# RFC 3986 §3.2.2: IP-literal = "[" ( IPv6address / IPvFuture ) "]".
|
|
33
|
+
_H16 = "[0-9A-Fa-f]{1,4}"
|
|
34
|
+
_DEC_OCTET = "(?:25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])"
|
|
35
|
+
_IPV4 = r"%s(?:\.%s){3}" % (_DEC_OCTET, _DEC_OCTET)
|
|
36
|
+
_LS32 = "(?:%s:%s|%s)" % (_H16, _H16, _IPV4)
|
|
37
|
+
_IPV6 = "|".join([
|
|
38
|
+
"(?:%s:){6}%s" % (_H16, _LS32),
|
|
39
|
+
"::(?:%s:){5}%s" % (_H16, _LS32),
|
|
40
|
+
"(?:%s)?::(?:%s:){4}%s" % (_H16, _H16, _LS32),
|
|
41
|
+
"(?:(?:%s:){0,1}%s)?::(?:%s:){3}%s" % (_H16, _H16, _H16, _LS32),
|
|
42
|
+
"(?:(?:%s:){0,2}%s)?::(?:%s:){2}%s" % (_H16, _H16, _H16, _LS32),
|
|
43
|
+
"(?:(?:%s:){0,3}%s)?::%s:%s" % (_H16, _H16, _H16, _LS32),
|
|
44
|
+
"(?:(?:%s:){0,4}%s)?::%s" % (_H16, _H16, _LS32),
|
|
45
|
+
"(?:(?:%s:){0,5}%s)?::%s" % (_H16, _H16, _H16),
|
|
46
|
+
"(?:(?:%s:){0,6}%s)?::" % (_H16, _H16),
|
|
47
|
+
])
|
|
48
|
+
_IP_LITERAL = re.compile(r"\[(?:%s|[Vv][0-9A-Fa-f]+\.[%s%s:]+)\]" % (_IPV6, _UNRESERVED, _SUB_DELIMS), re.ASCII)
|
|
49
|
+
|
|
50
|
+
# RFC 8141 §2: NID = (alphanum) 0*30(ldh) (alphanum), then ":" and a non-empty NSS.
|
|
51
|
+
_URN_NAME = re.compile(r"([A-Za-z0-9][A-Za-z0-9-]{0,30}[A-Za-z0-9]):(.+)", re.ASCII | re.DOTALL)
|
|
52
|
+
_SPLIT = re.compile(r"([^:/?#]+):(?://([^/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?", re.DOTALL)
|
|
53
|
+
_TRIPLET = re.compile(r"%([0-9A-Fa-f]{2})")
|
|
54
|
+
_UNRESERVED_CHAR = re.compile(r"[A-Za-z0-9\-._~]", re.ASCII)
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def _percent(text: str, keep_encoded: bool = False) -> str:
|
|
58
|
+
"""Percent-encoding hex upper-cased (§6.2.2.1), and unreserved characters decoded unless ``keep_encoded``."""
|
|
59
|
+
def one(match: "re.Match[str]") -> str:
|
|
60
|
+
char = chr(int(match.group(1), 16))
|
|
61
|
+
return char if not keep_encoded and _UNRESERVED_CHAR.fullmatch(char) else "%" + match.group(1).upper()
|
|
62
|
+
return _TRIPLET.sub(one, text)
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
def _strip_leading_dots(path: str) -> str:
|
|
66
|
+
"""A rootless path loses its leading "./" and "../" segments while what is left stays rootless (DEC-0076)."""
|
|
67
|
+
start = 0
|
|
68
|
+
while path.startswith("./", start) or path.startswith("../", start):
|
|
69
|
+
start += 2 if path.startswith("./", start) else 3
|
|
70
|
+
rest = path[start:]
|
|
71
|
+
return path if rest == "" or rest.startswith("/") else rest
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
def _remove_dot_segments(path: str) -> str:
|
|
75
|
+
"""RFC 3986 §5.2.4 remove_dot_segments over a path whose "." and ".." are already decoded."""
|
|
76
|
+
absolute = path.startswith("/")
|
|
77
|
+
segments = (path[1:] if absolute else path).split("/")
|
|
78
|
+
output = []
|
|
79
|
+
for index, segment in enumerate(segments):
|
|
80
|
+
last = index == len(segments) - 1
|
|
81
|
+
if segment in (".", ".."):
|
|
82
|
+
if segment == ".." and output:
|
|
83
|
+
output.pop()
|
|
84
|
+
if last: # a dot segment that ends the path leaves it ending in "/"
|
|
85
|
+
output.append("")
|
|
86
|
+
continue
|
|
87
|
+
output.append(segment)
|
|
88
|
+
return ("/" if absolute else "") + "/".join(output)
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
def _authority_parts(authority: str) -> Optional[Tuple[Optional[str], str, Optional[str]]]:
|
|
92
|
+
at = authority.rfind("@")
|
|
93
|
+
userinfo = None if at == -1 else authority[:at]
|
|
94
|
+
host_port = authority if at == -1 else authority[at + 1:]
|
|
95
|
+
bracket = host_port.find("]") if host_port.startswith("[") else -1
|
|
96
|
+
colon = host_port.find(":", 0 if bracket == -1 else bracket)
|
|
97
|
+
host = host_port if colon == -1 else host_port[:colon]
|
|
98
|
+
port = None if colon == -1 else host_port[colon + 1:]
|
|
99
|
+
if userinfo is not None and not _USERINFO.fullmatch(userinfo):
|
|
100
|
+
return None
|
|
101
|
+
if port is not None and not _PORT.fullmatch(port):
|
|
102
|
+
return None
|
|
103
|
+
if not (_IP_LITERAL.fullmatch(host) if host.startswith("[") else _REG_NAME.fullmatch(host)):
|
|
104
|
+
return None
|
|
105
|
+
return userinfo, host, port
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
def _parse(text: str) -> Optional[Tuple[str, Optional[str], str, Optional[str], Optional[str]]]:
|
|
109
|
+
"""RFC 3986 Appendix B's split, then each component checked against its §3 production; None when one fails."""
|
|
110
|
+
match = _SPLIT.fullmatch(text)
|
|
111
|
+
if not match:
|
|
112
|
+
return None
|
|
113
|
+
scheme, authority, path, query, fragment = match.groups()
|
|
114
|
+
path = path or ""
|
|
115
|
+
if not _SCHEME.fullmatch(scheme) or not _PATH.fullmatch(path):
|
|
116
|
+
return None
|
|
117
|
+
if query is not None and not _QUERY.fullmatch(query):
|
|
118
|
+
return None
|
|
119
|
+
if fragment is not None and not _QUERY.fullmatch(fragment):
|
|
120
|
+
return None
|
|
121
|
+
if authority is not None and _authority_parts(authority) is None:
|
|
122
|
+
return None
|
|
123
|
+
if authority is None and path == "":
|
|
124
|
+
return None
|
|
125
|
+
return scheme, authority, path, query, fragment
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
def _urn_form(authority: Optional[str], path: str, query: Optional[str]) -> str:
|
|
129
|
+
name = _URN_NAME.fullmatch(path)
|
|
130
|
+
path = "%s:%s" % (name.group(1).lower(), _percent(name.group(2), True)) if name else _percent(path, True)
|
|
131
|
+
# A "?" not followed by "+" or "=" is no URN component (RFC 8141 §2): it is kept, never dropped unread.
|
|
132
|
+
kept = "?" + _percent(query, True) if query is not None and not re.match(r"[+=]", query) else ""
|
|
133
|
+
auth = "//" + _percent(authority, True) if authority is not None else ""
|
|
134
|
+
return "urn:%s%s%s" % (auth, path, kept)
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
def _generic_form(scheme: str, authority: Optional[str], path: str, query: Optional[str], fragment: Optional[str]) -> str:
|
|
138
|
+
auth = ""
|
|
139
|
+
if authority is not None:
|
|
140
|
+
userinfo, host, port = _authority_parts(authority) # type: ignore[misc]
|
|
141
|
+
# The host is case-insensitive (§3.2.2); its remaining percent triplets keep upper-case hex.
|
|
142
|
+
lowered = re.sub(r"%[0-9a-f]{2}", lambda m: m.group(0).upper(), _percent(host).lower())
|
|
143
|
+
auth = "//%s%s%s" % ("" if userinfo is None else _percent(userinfo) + "@", lowered, "" if port is None else ":" + port)
|
|
144
|
+
decoded = _percent(path)
|
|
145
|
+
hierarchical = authority is not None or decoded.startswith("/")
|
|
146
|
+
out = _remove_dot_segments(decoded) if hierarchical else _strip_leading_dots(decoded)
|
|
147
|
+
if authority is None and out.startswith("//"): # it would read as an authority: keep the decoded path
|
|
148
|
+
out = decoded
|
|
149
|
+
q = "" if query is None else "?" + _percent(query)
|
|
150
|
+
f = "" if fragment is None else "#" + _percent(fragment)
|
|
151
|
+
return "%s:%s%s%s%s" % (scheme.lower(), auth, out, q, f)
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
def normal_identifier(value: Any) -> Optional[str]:
|
|
155
|
+
"""The normal form of an identifier: a URI's syntax-normalized form (RFC 3986 §6.2.2; RFC 8141 §3.1 for `urn:`),
|
|
156
|
+
any other string as it is, None for a value that is not a string. The contract's `normalIdentifier`."""
|
|
157
|
+
if not isinstance(value, str):
|
|
158
|
+
return None
|
|
159
|
+
parts = _parse(value)
|
|
160
|
+
if parts is None:
|
|
161
|
+
return value
|
|
162
|
+
scheme, authority, path, query, fragment = parts
|
|
163
|
+
return _urn_form(authority, path, query) if scheme.lower() == "urn" else _generic_form(scheme, authority, path, query, fragment)
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
def _strict_equal(a: Any, b: Any) -> bool:
|
|
167
|
+
"""JavaScript's === on parsed JSON: numbers by value, booleans only with booleans, objects by identity."""
|
|
168
|
+
if isinstance(a, bool) or isinstance(b, bool):
|
|
169
|
+
return isinstance(a, bool) and isinstance(b, bool) and a == b
|
|
170
|
+
if isinstance(a, (int, float)) and isinstance(b, (int, float)):
|
|
171
|
+
return a == b
|
|
172
|
+
if isinstance(a, (dict, list)) or isinstance(b, (dict, list)):
|
|
173
|
+
return a is b
|
|
174
|
+
return type(a) is type(b) and a == b
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
def same_identifier(a: Any, b: Any) -> bool:
|
|
178
|
+
"""Two identifiers are the same when their normal forms are equal (DEC-0076). A value that is not a string is no
|
|
179
|
+
identifier and is compared as it is (JavaScript's ===). The contract's `sameIdentifier`."""
|
|
180
|
+
if not isinstance(a, str) or not isinstance(b, str):
|
|
181
|
+
return _strict_equal(a, b)
|
|
182
|
+
return normal_identifier(a) == normal_identifier(b)
|
package/plugins/fabric-agent-adapter/skills/adapting-projects-to-fabric/scripts/fabric_provider.py
CHANGED
|
@@ -142,7 +142,8 @@ def _run_problems(run: Any) -> List[str]:
|
|
|
142
142
|
|
|
143
143
|
|
|
144
144
|
def manifest_problems(entry: Dict[str, Any]) -> List[str]:
|
|
145
|
-
"""FAC-SEM-014 (DEC-0017), URI half: the manifest resolves and its provider.id equals providerId
|
|
145
|
+
"""FAC-SEM-014 (DEC-0017), URI half: the manifest resolves and its provider.id equals providerId, compared by normal
|
|
146
|
+
form (DEC-0076)."""
|
|
146
147
|
try:
|
|
147
148
|
manifest = json.loads(Path(os.path.expanduser(str(entry["manifest"]))).read_text(encoding="utf-8"))
|
|
148
149
|
except (OSError, ValueError):
|
|
@@ -150,7 +151,8 @@ def manifest_problems(entry: Dict[str, Any]) -> List[str]:
|
|
|
150
151
|
provider = manifest.get("provider") if isinstance(manifest, dict) else None
|
|
151
152
|
if not isinstance(provider, dict) or not isinstance(manifest.get("capabilities"), list):
|
|
152
153
|
return ["%s is not a provider manifest (FAC-SEM-014)" % entry["manifest"]]
|
|
153
|
-
|
|
154
|
+
import fabric_identifiers # noqa: E402 - beside this file; DEC-0076: URIs compared by normal form
|
|
155
|
+
if not fabric_identifiers.same_identifier(provider.get("id"), entry["providerId"]):
|
|
154
156
|
return ["providerId %s is not the manifest's provider.id %s (FAC-SEM-014)" % (entry["providerId"], provider.get("id"))]
|
|
155
157
|
return []
|
|
156
158
|
|
|
@@ -195,6 +197,9 @@ def write_provider_entry(entry: Dict[str, Any], directory: Optional[Path] = None
|
|
|
195
197
|
clash = _service_ids(services or services_dir()).get(entry["id"])
|
|
196
198
|
if clash:
|
|
197
199
|
raise ProviderError("%s is already a service (%s); an id is a service or a provider, never both (FAC-SEM-013)." % (entry["id"], clash))
|
|
200
|
+
import fabric_identifiers # noqa: E402 - beside this file
|
|
201
|
+
# DEC-0076: written in its normal form, so a reader that looks it up finds one spelling.
|
|
202
|
+
entry = dict(entry, providerId=fabric_identifiers.normal_identifier(entry["providerId"]))
|
|
198
203
|
target = (directory or providers_dir()) / ("%s.json" % entry["id"])
|
|
199
204
|
_atomic_write(target, (json.dumps(entry, indent=2, ensure_ascii=False) + "\n").encode())
|
|
200
205
|
return target
|
|
@@ -16,10 +16,10 @@ license: AGPL-3.0-only OR LicenseRef-PassionCode-Commercial
|
|
|
16
16
|
compatibility: Python 3.9+ or Node.js 20+ for the kits; the probe needs Python 3.9+. launchd steps are macOS-only; Linux services install a systemd user unit and Windows ones a per-user Scheduled Task with the kits' writers. Dashboard handoff optionally uses Fabric Dashboards MCP link/host_status/open; without it, report unresolved host capability. The contract checkout is optional.
|
|
17
17
|
metadata:
|
|
18
18
|
author: PassionCode.ai
|
|
19
|
-
version: "0.
|
|
19
|
+
version: "0.26.0"
|
|
20
20
|
contract-version: "0.1.0"
|
|
21
21
|
extension: "fabric-service/0.1"
|
|
22
|
-
extension-commit: "
|
|
22
|
+
extension-commit: "a046f57cf46ea9e3da57ff8ce6a3ed4d26d8774b"
|
|
23
23
|
---
|
|
24
24
|
|
|
25
25
|
# Building Fabric services
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
# fabric-service/0.1 — wire reference
|
|
2
2
|
|
|
3
|
-
Pinned to `fabric-agent-contract` commit `
|
|
3
|
+
Pinned to `fabric-agent-contract` commit `a046f57cf46ea9e3da57ff8ce6a3ed4d26d8774b`
|
|
4
4
|
(`docs/specification/service.md`, DEC-0015; the usage report DEC-0021; Windows and Linux supervision
|
|
5
5
|
DEC-0032 and DEC-0033; the operator channel DEC-0034 and DEC-0035; the embedded dashboard DEC-0036;
|
|
6
6
|
delegation and the operator session's lifetime DEC-0039; the meter's call window DEC-0041; session handoff DEC-0042;
|
|
7
7
|
canonical forms DEC-0043; `degraded[].setup` and `run.mcp.stdio.scope` DEC-0044; delegation sealed and trust tiers
|
|
8
8
|
DEC-0045; runner and model profiles DEC-0046; the estate record DEC-0055; one copy under any supervisor and its marker,
|
|
9
9
|
the Windows token-file reader DEC-0057; the hub key the estate certifies DEC-0060; signing credentials DEC-0063; the
|
|
10
|
-
estate record's 60 s skew DEC-0066
|
|
10
|
+
estate record's 60 s skew DEC-0066; an app's own descriptor DEC-0069; the descriptor for listings DEC-0061; identifier equality
|
|
11
|
+
by normal form DEC-0076). The contract's schemas are normative;
|
|
11
12
|
this page is the working summary. Extension key:
|
|
12
13
|
`https://fabric.passioncode.ai/agent-contract/extensions/service/0.1`.
|
|
13
14
|
|
|
@@ -41,6 +42,17 @@ File `<id>.<instance>.json`, mode 0600 (on Windows a protected ACL), atomic.
|
|
|
41
42
|
| `runner` | optional `{kind?, credentialKind}` (DEC-0061): `credentialKind` `subscription`, `key`, `platform-metered` or `none` — a kind, never a credential (`FAC-SEM-086` refuses a credential-shaped value here or in `installedBy`); a subscription names its vendor's runner (`claude-code`, `kimi-code`, `codex`) |
|
|
42
43
|
| `peer` | optional `{endpoint, custody, residency, maxDataClass}` (DEC-0061): the service is offered to others. `endpoint` `https://<dns-name>[:<port>][/<path>]`, never a reserved name (`FAC-SEM-085`); `custody` `organization-managed` or `personal`; `residency` 1–32 ISO 3166-1 alpha-2 codes, `EU` admitted, user-assigned codes refused; `maxDataClass` `public` < `internal` < `confidential` < `restricted`. An offer needs `runner` and never runs on a subscription. A host sends a request from anyone but the operator only when `peer_refusal` / `peerRefusal` answers null (`FAC-SEM-088`); usage rows may take `route: "platform-metered"` |
|
|
43
44
|
|
|
45
|
+
## Identifier equality (DEC-0076)
|
|
46
|
+
|
|
47
|
+
Two identifiers are the same when their normal forms are equal. `normal_identifier` / `normalIdentifier` and
|
|
48
|
+
`same_identifier` / `sameIdentifier` (`fabric_identifiers.py`, `fabric-identifiers.mjs`, ports of the contract's
|
|
49
|
+
`src/identifiers.ts`, held to its `identifiers.json`) apply RFC 3986 §6.2.2 to a URI: scheme and host lower-cased,
|
|
50
|
+
percent-encoding hex upper-cased, unreserved characters decoded, dot segments removed. A `urn:` follows RFC 8141 §3.1
|
|
51
|
+
instead: `urn` and the NID lower-cased, nothing decoded, the NSS's case kept. Any other string is its own normal form,
|
|
52
|
+
and a value that is not a string is compared as it is. The kits compare by it in FAC-SEM-030/032/034 (routes, bindings,
|
|
53
|
+
events), FAC-SEM-076 (estate grants and their revocations) and FAC-SEM-014 (a provider entry's `providerId`), and they
|
|
54
|
+
write the identifiers they scaffold in normal form.
|
|
55
|
+
|
|
44
56
|
## Well-known document — `GET /.well-known/fabric-service`
|
|
45
57
|
|
|
46
58
|
No auth; the Host/Origin guard applies; answered from memory in under 100 ms.
|
|
@@ -104,6 +116,24 @@ empty, or `null` for an empty log. Retain at least seven days or 1000 events.
|
|
|
104
116
|
path on the service origin, never an absolute URL. Optional SSE stream at
|
|
105
117
|
`surfaces.events.stream` carrying the same objects.
|
|
106
118
|
|
|
119
|
+
**Machine-readable `data` (DEC-0070).** An event may carry `data {schema, value}` beside its sentence: `schema` is the
|
|
120
|
+
absolute URI of a payload schema the service publishes; `value` is an object of at most 32 members, each a scalar (a
|
|
121
|
+
string of at most 500 characters, a number, a boolean, null), a list of at most 32 scalars, or an object of at most 32
|
|
122
|
+
scalar members. `text` stays the event: a host that ignores `data` loses nothing, and one that does not know the schema
|
|
123
|
+
treats `value` as opaque. No string in `value` sits under a credential's name or has a credential's shape
|
|
124
|
+
(`FAC-SEM-101`); personal data is the service's own duty. `make_event` / `makeEvent` (and `JsonlEventLog.append`) take
|
|
125
|
+
`data=` and refuse one that breaks either rule, naming the place, never the value; `check_service.py` checks the feed it
|
|
126
|
+
fetches (`events.data`). A host pinned before DEC-0070 that validates events against a closed copy refuses the member.
|
|
127
|
+
|
|
128
|
+
**Protocol revisions (DEC-0067).** The well-known document may list `protocols`, the revisions the service accepts: at
|
|
129
|
+
most N and N−1 per protocol, consecutive in the contract's register, each `<name>/<revision>` once, 1 to 64 entries
|
|
130
|
+
(`FAC-SEM-099`). `build_well_known` / `buildWellKnown` take `protocols=` and check it; list them only once your hosts
|
|
131
|
+
are pinned at or after DEC-0067, because the document is closed for an older reader. A service that receives a document
|
|
132
|
+
in a revision it does not read answers `negotiate_revision` / `negotiateRevision`'s `schema-unsupported` refusal before
|
|
133
|
+
reading it further (HTTP 400, or an MCP `isError` result's `structuredContent`); a receiver that accepts none answers its
|
|
134
|
+
own fault `no-accepted-revisions`. `PROTOCOL_REVISIONS` is the contract's register; `check_service.py` reads
|
|
135
|
+
`well-known.protocols`.
|
|
136
|
+
|
|
107
137
|
## Login code and the operator session — `POST /fabric/v1/login-code`
|
|
108
138
|
|
|
109
139
|
Token required → `{ "url": "/fabric/v1/login?code=<16–256 url-safe chars>", "expiresAt": "…" }`,
|
package/plugins/fabric-agent-adapter/skills/building-fabric-services/scripts/check_service.py
CHANGED
|
@@ -260,6 +260,11 @@ class Probe:
|
|
|
260
260
|
if "events" not in (wk.get("surfaces") or {}):
|
|
261
261
|
problems.append("surfaces.events missing")
|
|
262
262
|
self.add("well-known.shape", "FAIL" if problems else "PASS", "; ".join(problems) or "protocol, build, status, degraded, surfaces")
|
|
263
|
+
if "protocols" in wk:
|
|
264
|
+
# DEC-0067, FAC-SEM-099: the revisions it accepts, N and N−1 per protocol, each once.
|
|
265
|
+
findings = fs.protocols_findings(wk["protocols"])
|
|
266
|
+
self.add("well-known.protocols", "FAIL" if findings else "PASS",
|
|
267
|
+
"; ".join("%s %s" % (f["instancePath"], f["message"]) for f in findings) or ", ".join(wk["protocols"]))
|
|
263
268
|
self.configuration_rule()
|
|
264
269
|
svc = wk.get("service") or {}
|
|
265
270
|
answered = "%s.%s" % (svc.get("id"), svc.get("instance"))
|
|
@@ -346,6 +351,11 @@ class Probe:
|
|
|
346
351
|
bad.append("%s (text is not a sentence)" % e.get("id"))
|
|
347
352
|
self.add("events.page", "FAIL" if bad else "PASS",
|
|
348
353
|
("bad events: " + ", ".join(bad)) if bad else "%d event(s), cursor %r" % (len(events), page["cursor"]))
|
|
354
|
+
# DEC-0070, FAC-SEM-101: an event's data never carries a credential; the finding names the place, never the value.
|
|
355
|
+
leaks = fs.feed_data_findings(page)
|
|
356
|
+
if any(isinstance(e, dict) and "data" in e for e in events) or leaks:
|
|
357
|
+
self.add("events.data", "FAIL" if leaks else "PASS",
|
|
358
|
+
"; ".join("%s: %s" % (f["instancePath"], f["message"]) for f in leaks) or "every event's data is free of credentials")
|
|
349
359
|
|
|
350
360
|
def usage_rules(self) -> None:
|
|
351
361
|
"""DEC-0021: a declared usage report requires the token and adds up (FAC-SEM-025)."""
|
package/plugins/fabric-agent-adapter/skills/building-fabric-services/scripts/fabric-estate.mjs
CHANGED
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
import crypto from 'node:crypto';
|
|
14
14
|
import { jcs } from './fabric-delegation.mjs';
|
|
15
|
+
import { normalIdentifier } from './fabric-identifiers.mjs';
|
|
15
16
|
import { secretValue } from './fabric-secrets.mjs';
|
|
16
17
|
|
|
17
18
|
export const ESTATE_RECORD_SCHEMA = 'estate-record/1';
|
|
@@ -428,12 +429,14 @@ function secretReferences(value, flag) {
|
|
|
428
429
|
}
|
|
429
430
|
|
|
430
431
|
function grantsAndRevocations(value, flag) {
|
|
432
|
+
// A grant's id is a URI, so grants and their revocations are keyed by its normal form (DEC-0076).
|
|
433
|
+
const grantKey = (id) => (typeof id === 'string' ? normalIdentifier(id) : id);
|
|
431
434
|
const grantIds = new Set();
|
|
432
435
|
list(value.shareGrants).forEach((grant, index) => {
|
|
433
436
|
if (grant.principalKind !== 'external') flag(`/shareGrants/${index}/principalKind`, 'a share grant is to a principal outside the estate: principalKind external');
|
|
434
437
|
const id = isObject(grant.meta) ? grant.meta.id : undefined;
|
|
435
|
-
if (grantIds.has(id)) flag(`/shareGrants/${index}/meta/id`, `grant ${String(id)} is listed twice`);
|
|
436
|
-
grantIds.add(id);
|
|
438
|
+
if (grantIds.has(grantKey(id))) flag(`/shareGrants/${index}/meta/id`, `grant ${String(id)} is listed twice`);
|
|
439
|
+
grantIds.add(grantKey(id));
|
|
437
440
|
});
|
|
438
441
|
const machines = list(value.machines);
|
|
439
442
|
// A Map, so a kind such as `constructor` or `__proto__` reads nothing from Object.prototype.
|
|
@@ -448,10 +451,11 @@ function grantsAndRevocations(value, flag) {
|
|
|
448
451
|
}));
|
|
449
452
|
const seen = new Set();
|
|
450
453
|
list(value.revocations).forEach((revocation, index) => {
|
|
451
|
-
const
|
|
454
|
+
const ref = revocation.kind === 'grant' ? grantKey(revocation.ref) : revocation.ref;
|
|
455
|
+
const key = `${String(revocation.kind)} ${String(ref)}`;
|
|
452
456
|
if (seen.has(key)) flag(`/revocations/${index}`, `the ${String(revocation.kind)} ${String(revocation.ref)} is revoked twice`);
|
|
453
457
|
seen.add(key);
|
|
454
|
-
if (listed.get(String(revocation.kind))?.has(
|
|
458
|
+
if (listed.get(String(revocation.kind))?.has(ref)) flag(`/revocations/${index}/ref`, `the record still lists the ${String(revocation.kind)} it revokes: revocation outranks addition`);
|
|
455
459
|
});
|
|
456
460
|
}
|
|
457
461
|
|