@passioncode-ai/fabric-agent-adapter 0.39.1 → 0.41.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 +203 -0
- package/README.md +18 -6
- package/SECURITY.md +27 -6
- package/bin/fabric-agent-adapter.js +71 -6
- package/package.json +2 -2
- package/plugins/fabric-agent-adapter/.claude-plugin/plugin.json +1 -1
- package/plugins/fabric-agent-adapter/skills/adapting-projects-to-fabric/SKILL.md +42 -66
- package/plugins/fabric-agent-adapter/skills/adapting-projects-to-fabric/references/dashboard-links.md +4 -2
- package/plugins/fabric-agent-adapter/skills/adapting-projects-to-fabric/references/operator-channel-and-repository.md +55 -0
- package/plugins/fabric-agent-adapter/skills/adapting-projects-to-fabric/references/provider-entry.md +9 -3
- package/plugins/fabric-agent-adapter/skills/adapting-projects-to-fabric/references/verification.md +15 -0
- package/plugins/fabric-agent-adapter/skills/adapting-projects-to-fabric/scripts/adapt_project.py +181 -26
- package/plugins/fabric-agent-adapter/skills/adapting-projects-to-fabric/scripts/check_dashboard_link.py +66 -5
- package/plugins/fabric-agent-adapter/skills/adapting-projects-to-fabric/scripts/fabric_provider.py +81 -23
- package/plugins/fabric-agent-adapter/skills/adapting-projects-to-fabric/scripts/fabric_secrets.py +1 -1
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/SKILL.md +42 -33
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/assets/dashboard-kit/fabric-button.js +21 -9
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/assets/dashboard-kit/fabric-dashboard.css +1 -1
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/assets/dashboard-kit/fabric-dashboard.js +2 -2
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/assets/dashboard-kit/kit.json +9 -4
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/recipes/support-agent/README.md +104 -0
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/recipes/support-agent/config.example.json +15 -0
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/recipes/support-agent/knowledge.example.json +13 -0
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/recipes/support-agent/support_agent.py +465 -0
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/references/board.md +21 -5
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/references/connectors.md +93 -0
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/references/dashboard-kit.md +2 -1
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/references/dashboard-links.md +4 -2
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/references/delegation.md +3 -2
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/references/estate-record.md +5 -4
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/references/interop.md +5 -0
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/references/kit-modules.md +129 -0
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/references/lifecycle.md +3 -1
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/references/package.md +5 -1
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/references/usage.md +2 -0
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/scripts/check_dashboard_layout.mjs +48 -19
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/scripts/check_dashboard_link.py +66 -5
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/scripts/check_service.py +11 -184
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/scripts/check_service_rules.py +204 -0
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/scripts/dashboard_kit.py +53 -19
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/scripts/fabric-auth.mjs +288 -0
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/scripts/fabric-backups.mjs +327 -0
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/scripts/fabric-base.mjs +47 -0
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/scripts/fabric-board-fixture.mjs +79 -0
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/scripts/fabric-board-link.mjs +145 -0
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/scripts/fabric-board-session.mjs +848 -0
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/scripts/fabric-board-shapes.mjs +340 -0
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/scripts/fabric-board.mjs +42 -1237
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/scripts/fabric-ceremonies.mjs +7 -18
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/scripts/fabric-crypto.mjs +41 -0
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/scripts/fabric-delegation.mjs +15 -46
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/scripts/fabric-descriptor.mjs +387 -0
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/scripts/fabric-estate.mjs +11 -68
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/scripts/fabric-events.mjs +52 -0
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/scripts/fabric-http.mjs +231 -0
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/scripts/fabric-interop.mjs +50 -16
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/scripts/fabric-jsvalue.mjs +67 -0
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/scripts/fabric-lock.mjs +235 -0
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/scripts/fabric-logs.mjs +136 -0
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/scripts/fabric-openrouter.mjs +335 -0
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/scripts/fabric-package.mjs +146 -32
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/scripts/fabric-paths.mjs +69 -0
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/scripts/fabric-platform.mjs +164 -0
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/scripts/fabric-profiles.mjs +1 -32
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/scripts/fabric-protocols.mjs +122 -0
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/scripts/fabric-service.mjs +177 -2541
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/scripts/fabric-share.mjs +1 -8
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/scripts/fabric-supervisors.mjs +404 -0
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/scripts/fabric-time.mjs +46 -0
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/scripts/fabric-usage.mjs +458 -0
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/scripts/fabric_auth.py +408 -0
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/scripts/fabric_backups.py +399 -0
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/scripts/fabric_base.py +91 -0
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/scripts/fabric_board.py +64 -1398
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/scripts/fabric_board_fixture.py +116 -0
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/scripts/fabric_board_link.py +162 -0
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/scripts/fabric_board_session.py +882 -0
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/scripts/fabric_board_shapes.py +457 -0
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/scripts/fabric_ceremonies.py +36 -39
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/scripts/fabric_crypto.py +336 -0
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/scripts/fabric_delegation.py +113 -222
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/scripts/fabric_descriptor.py +586 -0
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/scripts/fabric_estate.py +44 -405
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/scripts/fabric_events.py +140 -0
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/scripts/fabric_http.py +402 -0
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/scripts/fabric_hub.py +6 -2
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/scripts/fabric_interop.py +119 -77
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/scripts/fabric_jsvalue.py +310 -0
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/scripts/fabric_kit.py +243 -0
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/scripts/fabric_lock.py +308 -0
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/scripts/fabric_logs.py +202 -0
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/scripts/fabric_openrouter.py +431 -0
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/scripts/fabric_package.py +285 -109
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/scripts/fabric_paths.py +102 -0
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/scripts/fabric_platform.py +338 -0
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/scripts/fabric_profiles.py +32 -39
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/scripts/fabric_protocols.py +173 -0
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/scripts/fabric_secrets.py +1 -1
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/scripts/fabric_service.py +298 -3450
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/scripts/fabric_share.py +8 -8
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/scripts/fabric_supervisors.py +437 -0
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/scripts/fabric_time.py +120 -0
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/scripts/fabric_usage.py +697 -0
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/scripts/kit.json +1621 -0
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/scripts/sample_service.py +25 -7
- package/plugins/fabric-agent-adapter/skills/creating-fabric-agents/SKILL.md +29 -60
- package/plugins/fabric-agent-adapter/skills/creating-fabric-agents/references/dashboard-links.md +4 -2
- package/plugins/fabric-agent-adapter/skills/creating-fabric-agents/references/models-and-providers.md +3 -0
- package/plugins/fabric-agent-adapter/skills/creating-fabric-agents/references/operator-channel-and-repository.md +55 -0
- package/plugins/fabric-agent-adapter/skills/creating-fabric-agents/scripts/check_dashboard_link.py +66 -5
- package/plugins/fabric-agent-adapter/skills/working-with-fabric/SKILL.md +3 -3
- package/plugins/fabric-agent-adapter/skills/working-with-fabric/references/native-host-hooks.md +2 -1
- package/plugins/fabric-agent-adapter/skills/working-with-fabric/references/session-hooks.md +26 -13
- package/plugins/fabric-agent-adapter/skills/working-with-fabric/scripts/fabric_session.py +122 -1392
- package/plugins/fabric-agent-adapter/skills/working-with-fabric/scripts/fabric_session_cli.py +278 -0
- package/plugins/fabric-agent-adapter/skills/working-with-fabric/scripts/fabric_session_env.py +539 -0
- package/plugins/fabric-agent-adapter/skills/working-with-fabric/scripts/fabric_session_hosts.py +324 -0
- package/plugins/fabric-agent-adapter/skills/working-with-fabric/scripts/fabric_session_mail.py +173 -0
- package/plugins/fabric-agent-adapter/skills/working-with-fabric/scripts/fabric_session_mcp.py +491 -0
- package/plugins/fabric-agent-adapter/skills/working-with-fabric/scripts/host_hooks.py +11 -1
- package/plugins/fabric-agent-adapter/skills/working-with-fabric/scripts/hosts/context.mjs +25 -2
- package/plugins/fabric-agent-adapter/skills/working-with-fabric/scripts/hosts/openclaw/index.mjs +4 -2
- package/plugins/fabric-agent-adapter/skills/working-with-fabric/scripts/hosts/opencode/fabric.mjs +2 -1
package/plugins/fabric-agent-adapter/skills/building-fabric-services/scripts/sample_service.py
CHANGED
|
@@ -264,6 +264,15 @@ def make_handler(svc: Service):
|
|
|
264
264
|
content_type="text/html; charset=utf-8")
|
|
265
265
|
self._send(404, {"error": "Not found."})
|
|
266
266
|
|
|
267
|
+
def _length(self, cap: int) -> "int | None":
|
|
268
|
+
"""The body's declared length, 0..cap; anything else answers 400 and reads nothing (finding 17)."""
|
|
269
|
+
raw = (self.headers.get("Content-Length") or "0").strip()
|
|
270
|
+
if raw.isdigit() and raw.isascii() and int(raw) <= cap:
|
|
271
|
+
return int(raw)
|
|
272
|
+
self.close_connection = True # an unread body must not be taken for the next request
|
|
273
|
+
self._send(400, {"error": "Content-Length must be a whole number of bytes up to %d." % cap})
|
|
274
|
+
return None
|
|
275
|
+
|
|
267
276
|
def do_POST(self) -> None: # noqa: N802
|
|
268
277
|
if not self._guard():
|
|
269
278
|
return
|
|
@@ -271,10 +280,12 @@ def make_handler(svc: Service):
|
|
|
271
280
|
if url.path == "/mcp":
|
|
272
281
|
if not self._token_ok():
|
|
273
282
|
return
|
|
274
|
-
length =
|
|
283
|
+
length = self._length(1048576)
|
|
284
|
+
if length is None:
|
|
285
|
+
return
|
|
275
286
|
try:
|
|
276
287
|
message = json.loads(self.rfile.read(length) or b"null")
|
|
277
|
-
except ValueError:
|
|
288
|
+
except (ValueError, RecursionError):
|
|
278
289
|
return self._send(400, {"jsonrpc": "2.0", "id": None, "error": {"code": -32700, "message": "Parse error."}})
|
|
279
290
|
try:
|
|
280
291
|
with svc.drain.work():
|
|
@@ -300,11 +311,18 @@ def make_handler(svc: Service):
|
|
|
300
311
|
return self._send(401, {"error": "Sign in first."})
|
|
301
312
|
if self.headers.get("X-Fabric-Request") != "1":
|
|
302
313
|
return self._send(403, {"error": "Missing request header."})
|
|
303
|
-
length =
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
314
|
+
length = self._length(65536)
|
|
315
|
+
if length is None:
|
|
316
|
+
return
|
|
317
|
+
try:
|
|
318
|
+
body = json.loads(self.rfile.read(length) or b"{}")
|
|
319
|
+
if not isinstance(body, dict):
|
|
320
|
+
raise ValueError("not an object")
|
|
321
|
+
event = svc.log.append(body.get("kind", "demo.note"), body.get("level", "info"),
|
|
322
|
+
body.get("text", "A note from the sample service."),
|
|
323
|
+
notify=bool(body.get("notify")), link=body.get("link"))
|
|
324
|
+
except (ValueError, RecursionError, fs.ServiceError) as exc: # finding 17: a 400, never a crash
|
|
325
|
+
return self._send(400, {"error": "The note is a JSON object the event log takes: %s" % exc})
|
|
308
326
|
return self._send(200, event)
|
|
309
327
|
self._send(404, {"error": "Not found."})
|
|
310
328
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: creating-fabric-agents
|
|
3
|
-
description: Use when designing and building a NEW agent or provider that must be Fabric-compatible from its first commit, «создай агента, совместимого с фабрикой Passion Code», «новый агент под Fabric», "create a fabric-compatible agent", "build a new Fabric provider", "fabric-ready agent from scratch", «агент в облаке организации», "which models and OpenRouter key for a new Fabric agent". Runs the intake grill (capability, named consumer, workflow
|
|
3
|
+
description: Use when designing and building a NEW agent or provider that must be Fabric-compatible from its first commit, «создай агента, совместимого с фабрикой Passion Code», «новый агент под Fabric», "create a fabric-compatible agent", "build a new Fabric provider", "fabric-ready agent from scratch", «агент в облаке организации», "which models and OpenRouter key for a new Fabric agent". Runs the intake grill (capability, named consumer, workflow or agent, profile, effects, where it runs, models, who pays, how it learns), turns source projects' recorded failures into planted eval fixtures, scaffolds the pinned contract bundle and sets the canary expectation. NOT for adapting an existing project (adapting-projects-to-fabric), making an agent a local or online Fabric service with a dashboard (building-fabric-services), a coding session working through Fabric or its board (working-with-fabric), the Fabric host or orchestrator, or agent design without Fabric.
|
|
4
4
|
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. Ships in one plugin with adapting-projects-to-fabric, whose scripts it reuses.
|
|
6
6
|
metadata:
|
|
7
7
|
author: PassionCode.ai
|
|
8
|
-
version: "0.
|
|
8
|
+
version: "0.41.0"
|
|
9
9
|
contract-version: "0.1.0"
|
|
10
10
|
contract-commit: "c55f2d5a11c9a0197e958e87212fca7ae1154769"
|
|
11
11
|
---
|
|
@@ -24,6 +24,10 @@ Use this skill to design and build a new provider. Do not use it to:
|
|
|
24
24
|
|
|
25
25
|
- adapt a project that already has a stable API, MCP/A2A surface, or CLI: that is
|
|
26
26
|
`adapting-projects-to-fabric`, and entering there skips nothing;
|
|
27
|
+
- run an agent as a local or online service with a dashboard on its own: that is
|
|
28
|
+
`building-fabric-services` (step 4 hands over to it for a new agent that needs one);
|
|
29
|
+
- work in a project through Fabric from a coding session (the board, claims): that is
|
|
30
|
+
`working-with-fabric`;
|
|
27
31
|
- design the Fabric host, registry, scheduler, admission service, or binding runtime;
|
|
28
32
|
- build a generic agent with no Fabric requirement: nothing here helps a project that
|
|
29
33
|
will never be a provider;
|
|
@@ -99,30 +103,21 @@ authored now: it grows from real traces once the provider runs, and the step-1 f
|
|
|
99
103
|
are its seed because a source project's recorded failures count as production.
|
|
100
104
|
|
|
101
105
|
**For a PassionCode.ai repository**, the new agent's repository follows the organization's
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
`observatory_credentials` and runs with `use_secret.py run --vault-only` (a long-running
|
|
118
|
-
service: `use_secret.py serve`), with `OBSERVATORY_VAULT_ONLY=1` in its environment. No `.env`
|
|
119
|
-
of its own, no key file beside its data, no value in code, configuration or a commit. A
|
|
120
|
-
workflow names the keys it needs in its checkpoint (`credentials`), never their values.
|
|
121
|
-
|
|
122
|
-
org-index `scripts/check_format.py` reports 0 findings for it before it is called done. **An agent
|
|
123
|
-
someone builds for themselves is not a PassionCode.ai repository:** its licence is its owner's
|
|
124
|
-
choice, nothing about it is published or listed by the organization, and none of these files is
|
|
125
|
-
required of it, though the verified MCP quick start is still how anyone learns to drive it.
|
|
106
|
+
repository standard (`knowledge/repository-standard.md`) from its first commit: the licence files,
|
|
107
|
+
the README quick start verified with a real client, `AGENTS.md` and `CLAUDE.md`, as
|
|
108
|
+
[the operator channel and the repository standard](references/operator-channel-and-repository.md)
|
|
109
|
+
lists them. An agent someone builds for themselves is not a PassionCode.ai repository: its licence
|
|
110
|
+
is its owner's choice and none of those files is required of it.
|
|
111
|
+
|
|
112
|
+
**Every credential the agent uses is read by name, never held as a value**, from its first commit:
|
|
113
|
+
the README's Configure section lists key NAMES. With Project Observatory installed, the agent finds
|
|
114
|
+
them with `observatory_credentials` and runs under
|
|
115
|
+
`python3 "$(project-observatory full-path)/tools/use_secret.py" run --vault-only <project> <NAME> -- <command>`
|
|
116
|
+
(a long-running service: `use_secret.py serve`), with `OBSERVATORY_VAULT_ONLY=1` in its environment.
|
|
117
|
+
Without it, the person's OS keychain or secret manager injects the key into the agent's environment
|
|
118
|
+
at start. Either way: no `.env` of its own, no key file beside its data, no value in argv, code,
|
|
119
|
+
configuration or a commit. A workflow names the keys it needs in its checkpoint (`credentials`),
|
|
120
|
+
never their values.
|
|
126
121
|
|
|
127
122
|
## Step 3: scaffold the provider bundle
|
|
128
123
|
|
|
@@ -193,31 +188,11 @@ purpose. Then record one expectation the report must carry:
|
|
|
193
188
|
## Step 6: propose the operator channel
|
|
194
189
|
|
|
195
190
|
If the agent has a human stop (a choice, an approval, a confirmation) or emits `notify: true`
|
|
196
|
-
events, propose its
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
1. create a bot with @BotFather;
|
|
203
|
-
2. put its token into the secret store (Project Observatory) under the name the agent reads
|
|
204
|
-
(for example `EXAMPLE_AGENT_TELEGRAM_BOT_TOKEN`), never into a chat, a file or the bundle;
|
|
205
|
-
3. run the agent's link command;
|
|
206
|
-
4. type the code it shows in the chat with the bot.
|
|
207
|
-
|
|
208
|
-
In a group shared with other bots the channel follows OC-14…OC-17 (DEC-0035): it stays silent
|
|
209
|
-
unless addressed (`/command@ThisBot`, a reply to its own message or a press of its own button; a
|
|
210
|
-
bare `/command` in a group is not addressed), and a channel nobody receives on is `degraded`
|
|
211
|
-
(`receiver-missing`). Say so in the proposal when the operator means to bind a shared group.
|
|
212
|
-
|
|
213
|
-
Record the answer (`accepted`, `declined` or `later`) in the agent's state and in the
|
|
214
|
-
report, and do not ask again; an agent that serves `surfaces.operatorChannel` also shows it as
|
|
215
|
-
`proposal` in its status document. Creating the bot, storing the token and enabling the channel are the
|
|
216
|
-
operator's action: never create the bot, ask for or store the token's value, or enable the
|
|
217
|
-
channel yourself. The default pin carries DEC-0034 and DEC-0035: a served status document is checked against
|
|
218
|
-
the pinned `schemas/operator-channel-status.schema.json`; the channel's runtime rules have no
|
|
219
|
-
probe rule here yet, so report them `NOT_RUN`. An agent with neither stops nor notify
|
|
220
|
-
events skips this step.
|
|
191
|
+
events, propose its operator channel (`fabric-operator-channel/0.1`, OC-11) to the operator once,
|
|
192
|
+
now, as the shared reference linked at step 2 describes: the
|
|
193
|
+
operator's four steps, the answer recorded and never asked again, and the bot, the token and
|
|
194
|
+
enabling the channel left to the operator. An agent with neither stops nor notify events skips
|
|
195
|
+
this step.
|
|
221
196
|
|
|
222
197
|
## Resilience and autonomy
|
|
223
198
|
|
|
@@ -239,12 +214,6 @@ operator channel answer (step 6); and the exact next command. Never summarize th
|
|
|
239
214
|
|
|
240
215
|
## Dashboard handoff: also for consumers
|
|
241
216
|
|
|
242
|
-
When handing a registered service dashboard to a person, or writing the generated
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
check the target device and host, and run the bundled output gate before delivery.
|
|
246
|
-
An installed host failure never means browser fallback. This applies in Claude
|
|
247
|
-
Code, Codex and other providers; it needs no host-specific hook. MCP unavailable:
|
|
248
|
-
report the unresolved capability or use an approved project resolver; no automatic
|
|
249
|
-
client configuration. Python unavailable: perform the reference's manual checks
|
|
250
|
-
and report the executable gate NOT_RUN. Headless agents need no dashboard.
|
|
217
|
+
When handing a registered service dashboard to a person, or writing the generated agent's
|
|
218
|
+
completion or notification instructions, read and apply [dashboard links](references/dashboard-links.md)
|
|
219
|
+
and run its output gate before delivery, in any host. Headless agents need no dashboard.
|
package/plugins/fabric-agent-adapter/skills/creating-fabric-agents/references/dashboard-links.md
CHANGED
|
@@ -83,8 +83,10 @@ or instructions alone do not prove all final answers from every agent are filter
|
|
|
83
83
|
path is required. Skills must be activated/loaded; install does not intercept every answer.
|
|
84
84
|
- MCP absent: report unresolved host capability once, use the project's approved
|
|
85
85
|
resolver/CLI if available. Do not write machine or agent MCP config automatically.
|
|
86
|
-
- Python absent: perform the comparisons above manually
|
|
87
|
-
|
|
86
|
+
- Python absent: perform the comparisons above manually, including the gate's own rules (a
|
|
87
|
+
path with a `.` or `..` segment, an encoded or backslash separator, or a query or fragment
|
|
88
|
+
name or value that reads as a credential, such as `code`, `key`, `auth` or `api_key`, is
|
|
89
|
+
refused); mark the executable gate NOT_RUN. Do not label the output mechanically validated.
|
|
88
90
|
|
|
89
91
|
Syntax is owned by Fabric Dashboards and `@passioncode-ai/fabric-service-host`:
|
|
90
92
|
[ADR-0005](https://github.com/passioncode-ai/fabric-dashboards/blob/51a7a80acf42781d7bec304cc87c655d48cc309b/docs/adr/0005-service-links.md).
|
|
@@ -87,6 +87,9 @@ change an embedding model without re-indexing every stored vector (search silent
|
|
|
87
87
|
- **Show spend.** An agent's interface shows spend per day, per provider and per model for 30 days; spend nobody sees
|
|
88
88
|
is spend nobody controls.
|
|
89
89
|
- **Unknown cost is `null`, never 0** (DEC-0087, `fabric-interop/0.2`).
|
|
90
|
+
- **The kit does this for a service.** `fabric_openrouter` (building-fabric-services, references/connectors.md): the
|
|
91
|
+
key from a named environment variable, the ceiling before every attempt at the full output budget, a receipt per
|
|
92
|
+
call, empty and `length` answers never returned as success, a fallback of another vendor required.
|
|
90
93
|
- **Attribution is off by default.** A product may send OpenRouter's attribution headers only with its operator's
|
|
91
94
|
setting and only for requests it originates (FAC-SEM-098); an agent a user built keeps the user's own.
|
|
92
95
|
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# The operator channel and the repository standard
|
|
2
|
+
|
|
3
|
+
Shared by `adapting-projects-to-fabric` and `creating-fabric-agents`; the two copies are byte-identical
|
|
4
|
+
(`test/test_shared_references.py`). "The agent" is the provider being adapted or created.
|
|
5
|
+
|
|
6
|
+
## The operator channel
|
|
7
|
+
|
|
8
|
+
If the agent has a human stop (a choice, an approval, a confirmation) or emits `notify: true`
|
|
9
|
+
events, propose its **operator channel** to the operator once, at the step that links here. The
|
|
10
|
+
channel is the agent's own messenger channel, first Telegram, that sends those events and answers
|
|
11
|
+
its stops with buttons: `fabric-operator-channel/0.1` (contract DEC-0034,
|
|
12
|
+
`docs/specification/operator-channel.md`), whose rule OC-11 this follows. Give the operator's four
|
|
13
|
+
steps:
|
|
14
|
+
|
|
15
|
+
1. create a bot with @BotFather;
|
|
16
|
+
2. put its token into the operator's secret store (Project Observatory where it is installed) under
|
|
17
|
+
the name the agent reads (for example `EXAMPLE_AGENT_TELEGRAM_BOT_TOKEN`), never into a chat, a
|
|
18
|
+
file or the bundle;
|
|
19
|
+
3. run the agent's link command;
|
|
20
|
+
4. type the code it shows in the chat with the bot.
|
|
21
|
+
|
|
22
|
+
In a group shared with other bots the channel follows OC-14 to OC-17 (DEC-0035): it stays silent
|
|
23
|
+
unless addressed (`/command@ThisBot`, a reply to its own message or a press of its own button; a
|
|
24
|
+
bare `/command` in a group is not addressed), and a channel nobody receives on is `degraded`
|
|
25
|
+
(`receiver-missing`). Say so in the proposal when the operator means to bind a shared group.
|
|
26
|
+
|
|
27
|
+
Record the answer (`accepted`, `declined` or `later`) in the agent's state and in its conformance
|
|
28
|
+
report, and do not ask again; an agent that serves `surfaces.operatorChannel` also shows it as
|
|
29
|
+
`proposal` in its status document. Creating the bot, storing the token and enabling the channel
|
|
30
|
+
are the operator's action: never create the bot, ask for or store the token's value, or enable the
|
|
31
|
+
channel yourself. The default pin carries DEC-0034 and DEC-0035: a served status document is
|
|
32
|
+
checked against the pinned `schemas/operator-channel-status.schema.json`; the channel's runtime
|
|
33
|
+
rules have no probe rule here yet, so report them `NOT_RUN`. An agent with neither stops nor notify
|
|
34
|
+
events skips this.
|
|
35
|
+
|
|
36
|
+
## The repository standard
|
|
37
|
+
|
|
38
|
+
For a PassionCode.ai repository, the agent's repository follows the organization's
|
|
39
|
+
[repository standard](https://github.com/passioncode-ai/fabric-workspace/blob/main/knowledge/repository-standard.md)
|
|
40
|
+
(`knowledge/repository-standard.md` in the organization's knowledge base; a clone has it at
|
|
41
|
+
`fabric-workspace/knowledge/`) from its first commit:
|
|
42
|
+
|
|
43
|
+
- `LICENSE`, `COMMERCIAL-LICENSE.md` and `CLA.md` copied byte for byte from the knowledge base's
|
|
44
|
+
`templates/`, and `AGPL-3.0-only OR LicenseRef-PassionCode-Commercial` in every manifest and
|
|
45
|
+
every SKILL.md `license:`; `SECURITY.md` when the repository is public;
|
|
46
|
+
- a README whose first heading is the full name, with `## Quick start for a new teammate`
|
|
47
|
+
(Install; Configure, key names only; MCP, the registration command and one proving tool call,
|
|
48
|
+
verified with a real client in a temporary config; Develop) and `## License`;
|
|
49
|
+
- an `AGENTS.md` that opens with the template's *Read first* block and closes with *After work*,
|
|
50
|
+
and a `CLAUDE.md` whose first line is `@AGENTS.md`.
|
|
51
|
+
|
|
52
|
+
org-index `scripts/check_format.py` reports 0 findings for it before it is called done. An agent
|
|
53
|
+
someone builds for themselves is not a PassionCode.ai repository: its licence is its owner's
|
|
54
|
+
choice, nothing about it is published or listed by the organization, and none of these files is
|
|
55
|
+
required of it, though the verified MCP quick start is still how anyone learns to drive it.
|
package/plugins/fabric-agent-adapter/skills/creating-fabric-agents/scripts/check_dashboard_link.py
CHANGED
|
@@ -7,7 +7,7 @@ This is an output correctness gate, not authentication, discovery, or a relay.
|
|
|
7
7
|
import json
|
|
8
8
|
import re
|
|
9
9
|
import sys
|
|
10
|
-
from urllib.parse import parse_qs, urlsplit
|
|
10
|
+
from urllib.parse import parse_qs, parse_qsl, unquote, urlsplit
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
def require(condition, reason):
|
|
@@ -15,6 +15,63 @@ def require(condition, reason):
|
|
|
15
15
|
raise ValueError(reason)
|
|
16
16
|
|
|
17
17
|
|
|
18
|
+
# Credential names and values: the same rules as fabric-button.js (credentialName, secretValue).
|
|
19
|
+
CREDENTIAL_WORDS = {
|
|
20
|
+
'token', 'secret', 'password', 'passwd', 'pass', 'passphrase', 'credential', 'credentials', 'cookie',
|
|
21
|
+
'authorization', 'bearer', 'jwt', 'otp', 'apikey', 'signature', 'sig', 'accesstoken', 'idtoken', 'authtoken',
|
|
22
|
+
'refreshtoken', 'sessionid', 'sessiontoken', 'logincode', 'authcode', 'privatekey', 'clientsecret', 'secretkey',
|
|
23
|
+
'accesskey'}
|
|
24
|
+
CREDENTIAL_PAIRS = {
|
|
25
|
+
'key': {'private', 'api', 'access', 'secret', 'session', 'auth', 'signing', 'encryption', 'master', 'client', 'login',
|
|
26
|
+
'refresh'},
|
|
27
|
+
'auth': {'token', 'code', 'header'},
|
|
28
|
+
'session': {'token', 'id'},
|
|
29
|
+
'code': {'login', 'auth', 'access', 'session'}}
|
|
30
|
+
JWT_SHAPE = re.compile(r'eyJ[A-Za-z0-9_-]{2,}\.[A-Za-z0-9_-]{2,}\.[A-Za-z0-9_-]*')
|
|
31
|
+
SECRET_VALUE = re.compile(r'(^bearer\s.+|sk-[A-Za-z0-9_-]{16,}|gh[pousr]_[A-Za-z0-9]{20,}|xox[abposr]-[A-Za-z0-9-]{10,}'
|
|
32
|
+
r'|AKIA[0-9A-Z]{16}|glpat-[A-Za-z0-9_-]{20,})', re.I | re.S)
|
|
33
|
+
LONG_RUN = re.compile(r'[A-Za-z0-9+/=_-]{40,}')
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def name_words(name):
|
|
37
|
+
name = re.sub(r'([a-z0-9])([A-Z])', r'\1 \2', name)
|
|
38
|
+
name = re.sub(r'([A-Z]+)([A-Z][a-z])', r'\1 \2', name)
|
|
39
|
+
return [w.lower() for w in re.split(r'[\s._-]+', name) if w]
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def credential_name(name):
|
|
43
|
+
split = name_words(name)
|
|
44
|
+
words = set(split) | {w[:-1] for w in split if len(w) > 2 and w.endswith('s')}
|
|
45
|
+
if words & CREDENTIAL_WORDS:
|
|
46
|
+
return True
|
|
47
|
+
if len(split) == 1 and words & set(CREDENTIAL_PAIRS):
|
|
48
|
+
return True
|
|
49
|
+
return any(w in words and words & pairs for w, pairs in CREDENTIAL_PAIRS.items())
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
def secret_value(value):
|
|
53
|
+
long_secret = any(re.search(r'[a-z]', run) and re.search(r'[A-Z]', run) and re.search(r'[0-9]', run)
|
|
54
|
+
for run in LONG_RUN.findall(value))
|
|
55
|
+
return bool(JWT_SHAPE.search(value) or SECRET_VALUE.search(value) or long_secret)
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def carries_credential(text):
|
|
59
|
+
# A query or fragment whose names or values could be a credential: refused even with an empty value.
|
|
60
|
+
return (secret_value(text) or secret_value(unquote(text))
|
|
61
|
+
or any(credential_name(name) or secret_value(name) or secret_value(value)
|
|
62
|
+
for name, value in parse_qsl(text, keep_blank_values=True)))
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
def login_path(path):
|
|
66
|
+
# The path a server routes: refuse what normalises differently in different servers, then compare.
|
|
67
|
+
decoded = unquote(path)
|
|
68
|
+
require(not re.search(r'%2f|%5c', path, re.I) and '\\' not in decoded, 'encoded_separator')
|
|
69
|
+
segments = decoded.split('/')[1:]
|
|
70
|
+
require(not any(seg in ('.', '..') for seg in segments), 'dot_segment')
|
|
71
|
+
require(all(seg for seg in segments[:-1]), 'empty_segment')
|
|
72
|
+
return '/'.join([''] + [seg for seg in segments if seg]).lower() == '/fabric/v1/login'
|
|
73
|
+
|
|
74
|
+
|
|
18
75
|
def safe_path(path):
|
|
19
76
|
return (isinstance(path, str) and path.startswith('/') and not path.startswith('//')
|
|
20
77
|
and len(path) <= 2048 and not re.search(r'[\\\x00-\x1f\x7f]', path))
|
|
@@ -42,10 +99,14 @@ def check(data):
|
|
|
42
99
|
and not plain.username and not plain.password, 'invalid_http_fallback')
|
|
43
100
|
http_page = plain.path + ('?' + plain.query if plain.query else '') + ('#' + plain.fragment if plain.fragment else '')
|
|
44
101
|
require(safe_path(http_page) and http_page == (page or '/'), 'mismatched_page')
|
|
45
|
-
sensitive = {'token', 'access_token', 'refresh_token', 'password', 'secret', 'login_code'
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
102
|
+
sensitive = {'token', 'access_token', 'refresh_token', 'password', 'secret', 'login_code', 'code', 'api_key',
|
|
103
|
+
'apikey', 'key', 'auth'}
|
|
104
|
+
parts = urlsplit(http_page)
|
|
105
|
+
places = [parts.query, parts.fragment] + parts.fragment.split('?', 1)[1:]
|
|
106
|
+
require(not any(sensitive.intersection(k.lower() for k in parse_qs(p, keep_blank_values=True)) for p in places),
|
|
107
|
+
'credential_query')
|
|
108
|
+
require(not any(carries_credential(p) for p in places), 'credential_query')
|
|
109
|
+
require(not login_path(parts.path), 'login_link_is_not_dashboard')
|
|
49
110
|
state = host.get('state')
|
|
50
111
|
require(state in ('available', 'not_installed', 'unknown', 'incompatible', 'handler_mismatch', 'unsupported'), 'unknown_host_state')
|
|
51
112
|
target, viewer = data.get('target_device'), data.get('viewer_device')
|
|
@@ -19,7 +19,7 @@ compatibility: >-
|
|
|
19
19
|
this plugin; Codex/Kimi use command hooks; Hermes/OpenCode/OpenClaw/Pi use native context plugins after opt-in.
|
|
20
20
|
metadata:
|
|
21
21
|
author: PassionCode.ai
|
|
22
|
-
version: "0.
|
|
22
|
+
version: "0.41.0"
|
|
23
23
|
---
|
|
24
24
|
|
|
25
25
|
# Working with Fabric
|
|
@@ -225,8 +225,8 @@ and do the work without claiming Fabric saw it.
|
|
|
225
225
|
In Claude Code this plugin ships four: at session start and `/clear` (not on compact or resume) the preamble above,
|
|
226
226
|
or, when Fabric is down and the project uses Fabric, one line pointing at Step 1; after each turn the turn's facts (HEAD, files changed, lines added
|
|
227
227
|
and removed) and the board's unread count; at each prompt one line only when that count rose; at the end, the
|
|
228
|
-
release of what the session left claimed. The turn, prompt and end hooks
|
|
229
|
-
`session-hooks/1
|
|
228
|
+
release of what the session left claimed. The turn, prompt and end hooks spool and call Fabric only when the running
|
|
229
|
+
Fabric advertises `session-hooks/1`; the turn and end hooks always prune their own stale spool. All are silent in a session Fabric launched, never block the session and read no token. Read
|
|
230
230
|
[session hooks](references/session-hooks.md) when a person asks what the hooks do, where they log, how to turn them
|
|
231
231
|
off, or what they need from Fabric.
|
|
232
232
|
|
package/plugins/fabric-agent-adapter/skills/working-with-fabric/references/native-host-hooks.md
CHANGED
|
@@ -26,7 +26,7 @@ python3 <skill-dir>/scripts/fabric_session.py install-host-hooks --host opencode
|
|
|
26
26
|
python3 <skill-dir>/scripts/fabric_session.py install-host-hooks --host opencode --remove
|
|
27
27
|
```
|
|
28
28
|
|
|
29
|
-
Use `codex`, `kimi`, `hermes`, `opencode`, `openclaw` or `pi`. Default is a dry run. `--config` overrides the native destination, `--script` selects an absolute `fabric_session.py` in a **complete installed skill**. Keep that path stable; a versioned plugin cache disappears on updates. Reapply after moving the skill. The native installer checks the helper and every required host module before writing a loader.
|
|
29
|
+
Use `codex`, `kimi`, `hermes`, `opencode`, `openclaw` or `pi`. Default is a dry run. `--config` overrides the native destination, `--script` selects an absolute `fabric_session.py` in a **complete installed skill**. Keep that path stable; a versioned plugin cache disappears on updates. Reapply after moving the skill: an install refuses a `--script` that is not an existing file, and Codex and Kimi Code rewrite their own hook in place to the new path (`updated`), finding a Kimi `[[hooks]]` table by the command it runs, not by its exact text. The native installer checks the helper and every required host module before writing a loader. Removal needs neither: it reads nothing from the skill it was installed from, so it works after that skill moved or lost its `hosts/` folder.
|
|
30
30
|
|
|
31
31
|
| Host | Default destination |
|
|
32
32
|
|---|---|
|
|
@@ -45,6 +45,7 @@ OpenCode and Pi loader files carry a managed marker. A foreign file at the same
|
|
|
45
45
|
|
|
46
46
|
- Native bridges give the Python helper only a working directory and, when observed, a boolean Fabric registration. Hermes uses its native read-only config, OpenCode its resolved enabled MCP entry, OpenClaw its resolved MCP servers and Pi an exact callable `fabric_whoami` tool name. Config registration is not admission.
|
|
47
47
|
- Missing helper/Python, malformed values, excessive output or a four-second deadline produce no context. Existing host errors and permission failures are not silenced globally.
|
|
48
|
+
- OpenCode and OpenClaw ask for context on every request; their bridges keep the helper's answer per workspace and registration for the life of the host process, so Python runs once, not per request. A failed run (an error, a nonzero exit, a timeout, no `python3`) reads as `null`, distinct from an empty answer `''`, and is not kept, so the next request asks again. A Fabric started later is seen by a new host instance.
|
|
48
49
|
- Fabric-launched sessions are silent. Other native events are not advertised: turn observations, unread counts and rejoin-only release remain Claude-specific and feature-gated.
|
|
49
50
|
- A host in Switchboard's catalog may support MCP, proxy or launch while exposing no startup context hook. Never copy this configuration to another host solely because it can launch an agent.
|
|
50
51
|
|
|
@@ -20,7 +20,7 @@ need from Fabric. In Claude Code they live in the plugin's `hooks/hooks.json` an
|
|
|
20
20
|
| Event | When it acts | What it does |
|
|
21
21
|
|---|---|---|
|
|
22
22
|
| SessionStart (`startup`, `clear`; the plugin's matcher, and the script ignores `compact` and `resume` for every host) | Claude Code has an MCP server named `fabric` (local, project or user scope) | Fabric running: adds the preamble: `fabric_whoami` first; `com.status` and `com.list`, `com.read_ack` only what was read; `fabric_work_list`, then `fabric_work_claim`; `fabric_work_release` at the end; ask another Project only through `com.submit`. Fabric down, in a project that uses Fabric (below): one line, skip `fabric_whoami` and the board, start Fabric through the lifecycle broker only if the task needs it. Fabric down anywhere else, or not registered: nothing. |
|
|
23
|
-
| Stop (each turn) | as for SessionStart, and the running Fabric's `hub.json` lists `"session-hooks/1"` in `features` | spools one entry and starts a detached worker that sends `fabric_session_observe {event: "turn", head, filesChanged, linesAdded, linesRemoved, …}
|
|
23
|
+
| Stop (each turn) | as for SessionStart, and the running Fabric's `hub.json` lists `"session-hooks/1"` in `features` | measures the turn's facts (HEAD, files changed, lines added and removed: counts and ids only, git sharing 1.5 s), spools them in one entry and starts a detached worker that sends `fabric_session_observe {event: "turn", head, filesChanged, linesAdded, linesRemoved, …}` as stored, then reads `com.status` and keeps the unread count in the session's spool (`board.json`) |
|
|
24
24
|
| UserPromptSubmit | the session's spool holds a count | adds ONE line, `N unread on the project board: com.list`, only when the count rose since the last line; a fall or the same count says nothing. It reads two small files and never calls Fabric. |
|
|
25
25
|
| SessionEnd | as for Stop | spools the end; the worker sends `fabric_work_release {claims: "session", outcome: "let-go", …}`, then `fabric_session_observe {event: "end", reason}`, and removes the session's spool |
|
|
26
26
|
|
|
@@ -31,8 +31,8 @@ outside a checkout; never above it); or a service descriptor whose `source.repos
|
|
|
31
31
|
`remote.origin.url`. The machine's service descriptors are no longer counted into the session: the host's own
|
|
32
32
|
instructions say how to read Fabric services (since 0.38.0).
|
|
33
33
|
|
|
34
|
-
Without `session-hooks/1`, Stop and SessionEnd read `hub.json`, return, and
|
|
35
|
-
nothing to show; `fabric_session.py status` says "Session hooks: inert". That is every Fabric before the release
|
|
34
|
+
Without `session-hooks/1`, Stop and SessionEnd read `hub.json`, return, and spool nothing (they only remove stale
|
|
35
|
+
session folders, below), so UserPromptSubmit has nothing to show; `fabric_session.py status` says "Session hooks: inert". That is every Fabric before the release
|
|
36
36
|
that ships the dependencies below. A board that cannot be read (`unavailable`, a refusal) leaves no count, never a
|
|
37
37
|
zero; a `degraded` board that still gives the count is read.
|
|
38
38
|
|
|
@@ -48,8 +48,10 @@ session id Fabric keeps with the enrollment, which only Claude Code supplies tod
|
|
|
48
48
|
would add (never a value already in the file) and the `--apply --expect-sha256 <digest>` command. With `--apply` it
|
|
49
49
|
backs the file up (`<file>.<UTC stamp>.bak`, never overwriting an earlier backup), keeps the file's mode, refuses a
|
|
50
50
|
file whose shape is not `{"hooks": {"<Event>": [{"hooks": [...]}]}}` (Codex) or an array of `[[hooks]]` tables
|
|
51
|
-
(Kimi Code, read back with `tomllib`: Python 3.11+), and refuses one that changed since the dry run.
|
|
52
|
-
|
|
51
|
+
(Kimi Code, read back with `tomllib`: Python 3.11+), and refuses one that changed since the dry run. It refuses a
|
|
52
|
+
`--script` that is not an existing file. Our own entry, found by what it runs (for Kimi Code each `[[hooks]]` table is
|
|
53
|
+
read on its own, so a hand-touched one is still found), is rewritten in place to the new script (`updated`) rather
|
|
54
|
+
than added a second time. `--remove` takes the entry out again, stale or not, and needs no script. Codex may ask the person to trust a new hook (`/hooks`) before it runs. Codex keys that trust by event, group and index, so
|
|
53
55
|
`--remove` names the SessionStart groups after the removed one that it moves, which Codex asks the person to approve
|
|
54
56
|
again. The hook runs the
|
|
55
57
|
`fabric_session.py` of the skills install (`~/.agents/skills/working-with-fabric/`) when there is one, else this
|
|
@@ -63,8 +65,10 @@ They consume the same context through their own APIs. They never use the Claude-
|
|
|
63
65
|
`fabric_session.py watch-mail [--interval 60]` is for an idle Claude Code session waiting on the board; the agent
|
|
64
66
|
starts it under a background watcher. It rejoins the session (`CLAUDE_CODE_SESSION_ID`, or `--session-id`) through
|
|
65
67
|
`fabric-mcp --rejoin-only` for each look, prints one line each time the unread count rises, and waits `interval`
|
|
66
|
-
± 20 % between looks (never under 10 s
|
|
67
|
-
|
|
68
|
+
± 20 % between looks (after the jitter never under 10 s and never over 15 minutes). It shares the session's
|
|
69
|
+
once-a-minute rejoin with the Stop worker: a look within a minute of the last rejoin (the worker's `rejoined` mark or
|
|
70
|
+
its own) waits instead, and its own rejoin renews that mark when the session's folder exists. While Fabric is down or
|
|
71
|
+
the board unreadable it says so once and backs off, doubling to at most 15 minutes. It exits on its stdin's end (when started with a pipe), SIGTERM, SIGINT or SIGHUP,
|
|
68
72
|
or when its parent is gone. It refuses to start in a session Fabric launched, and without a `fabric` registration.
|
|
69
73
|
|
|
70
74
|
## A session Fabric launched
|
|
@@ -78,13 +82,18 @@ only variable names are looked at, never a value (two of them carry the session'
|
|
|
78
82
|
`<Fabric's folder>/sessions/` (Codex).
|
|
79
83
|
3. Claude Code launched by Fabric has no variable yet: its command line holds `--mcp-config
|
|
80
84
|
<Fabric's folder>/sessions/<id>/mcp.json`. SessionStart, and Stop once per session, look for that in a few
|
|
81
|
-
ancestor processes (`ps`, bounded to 0.5 s each); only the match is used, nothing is kept
|
|
85
|
+
ancestor processes (`ps`, bounded to 0.5 s each); only the match is used, nothing is logged. A match is kept as
|
|
86
|
+
an empty `launched` file in the session's folder, so the walk runs once and nothing is spooled after it. A `ps`
|
|
87
|
+
that fails or runs out of time is "unknown", never "not launched": that hook spools nothing (so no worker can
|
|
88
|
+
release a launched session's claims) and the next one looks again.
|
|
82
89
|
|
|
83
90
|
## What they never do
|
|
84
91
|
|
|
85
92
|
- **Block or slow the session.** Each hook has a 5 s ceiling in `hooks.json`; the script reads a few small files and
|
|
86
|
-
returns in tens of milliseconds
|
|
87
|
-
|
|
93
|
+
returns in tens of milliseconds, plus the turn's git facts in Stop and SessionEnd (at most 1.5 s, shared by every
|
|
94
|
+
git call). Every call to Fabric happens in a detached worker with a 10 s deadline; at its end the worker closes
|
|
95
|
+
`fabric-mcp`'s stdin and then ends its whole process group, so a wrapper (`npx`, a shell script,
|
|
96
|
+
`fabric-mcp.cmd`) cannot keep it waiting. Every hook exits 0, on every path.
|
|
88
97
|
- **Read a secret.** The hooks never open Fabric's door token or an enrollment credential; `fabric-mcp` holds
|
|
89
98
|
those. Nothing secret is in argv (the worker's argv is the script and a spool folder) or in the log.
|
|
90
99
|
- **Send or read content.** A turn is the HEAD commit, the number of files that differ from it (untracked included)
|
|
@@ -96,8 +105,10 @@ only variable names are looked at, never a value (two of them carry the session'
|
|
|
96
105
|
- **Rejoin more than once a minute.** Every rejoin spends the agent's Fabric request budget, which every session of
|
|
97
106
|
the machine shares. A turn within 60 s of the session's last successful rejoin (the worker marks it as `rejoined`
|
|
98
107
|
in the session's folder) is spooled and waits for the next worker; the end of a session always starts one (FAA-53).
|
|
99
|
-
- **Retry in a loop.** A refused call is logged by its error code and
|
|
100
|
-
|
|
108
|
+
- **Retry in a loop.** A refused call, or one answered with a JSON-RPC error, is logged by its error code and its
|
|
109
|
+
entry dropped; an entry that cannot be read is logged as `outcome=dropped` and dropped. The entries after it, the
|
|
110
|
+
end's release and the end observation still go out. An answer that never came is logged as `outcome=unknown` and
|
|
111
|
+
leaves the spool to the next worker. The calls carry an `idempotencyKey`, so a repeat is the same event.
|
|
101
112
|
|
|
102
113
|
## Where they log, and how to turn them off
|
|
103
114
|
|
|
@@ -106,7 +117,9 @@ One line per event that did something, never content: `~/Library/Caches/ai.passi
|
|
|
106
117
|
`%LOCALAPPDATA%\fabric-agent-adapter\hooks.log` (Windows). Mode 0600, rotated at 1 MB to `hooks.log.1`. The
|
|
107
118
|
per-session spool is `sessions/<session id>/` beside it (turn entries capped at 50, `board.json`, `board.shown`; a
|
|
108
119
|
folder untouched for 7 days, whose worker failed or whose session ended without SessionEnd, is removed by the next
|
|
109
|
-
|
|
120
|
+
Stop or SessionEnd hook, even while the hooks are inert; an end entry whose release or observation got no answer stays
|
|
121
|
+
for the next worker, and the folder goes only once the end is delivered; a stale worker lock is taken by renaming it, never by a
|
|
122
|
+
check and a delete),
|
|
110
123
|
removed at the session's end.
|
|
111
124
|
|
|
112
125
|
Turn them off with Claude Code's own switch (`/hooks`, or `"disableAllHooks": true` in settings), or remove the
|