@passioncode-ai/fabric-agent-adapter 0.35.4 → 0.37.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 +58 -0
- 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 +2 -2
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/SKILL.md +7 -4
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/references/estate-record.md +45 -0
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/references/interop.md +37 -1
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/references/package.md +13 -0
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/references/protocol.md +1 -1
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/scripts/fabric-ceremonies.mjs +129 -0
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/scripts/fabric-estate.mjs +67 -4
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/scripts/fabric-interop.mjs +252 -5
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/scripts/fabric-profiles.mjs +5 -4
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/scripts/fabric-service.mjs +4 -3
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/scripts/fabric-share.mjs +109 -0
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/scripts/fabric_ceremonies.py +194 -0
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/scripts/fabric_estate.py +82 -4
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/scripts/fabric_interop.py +356 -9
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/scripts/fabric_profiles.py +10 -4
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/scripts/fabric_service.py +6 -4
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/scripts/fabric_share.py +173 -0
- package/plugins/fabric-agent-adapter/skills/building-fabric-services/scripts/share-registration.schema.json +218 -0
- package/plugins/fabric-agent-adapter/skills/creating-fabric-agents/SKILL.md +22 -5
- package/plugins/fabric-agent-adapter/skills/creating-fabric-agents/references/models-and-providers.md +105 -0
- package/plugins/fabric-agent-adapter/skills/creating-fabric-agents/references/orchestration-and-learning.md +100 -0
- package/plugins/fabric-agent-adapter/skills/creating-fabric-agents/references/practices.md +103 -0
- package/plugins/fabric-agent-adapter/skills/creating-fabric-agents/references/where-agents-run.md +112 -0
- 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/plugins/fabric-agent-adapter/skills/creating-fabric-agents/references/where-agents-run.md
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
# Where an agent runs: this machine, a personal cloud, an organization
|
|
2
|
+
|
|
3
|
+
An agent built with this skill can run on the person's own machine, in their personal cloud, or in an organization's
|
|
4
|
+
cloud, and the same agent can serve the person and several organizations at once. Decide where it runs at the intake
|
|
5
|
+
grill (*Where does it run?*), because it decides where its secrets live, who pays for its calls, whose journal records
|
|
6
|
+
it, and what happens when the person's laptop is closed.
|
|
7
|
+
|
|
8
|
+
The normative rules are the Fabric Agent Contract's, at the commit this plugin pins: `docs/specification/contexts.md`
|
|
9
|
+
(contexts), `estate-record.md` (machines and placements), `share-registration.md` (sharing into an organization),
|
|
10
|
+
`entitlement.md` (what an order entitles), `ceremonies.md` (adding a machine). This page says how to design for them.
|
|
11
|
+
|
|
12
|
+
## Contents
|
|
13
|
+
|
|
14
|
+
- [The places](#the-places)
|
|
15
|
+
- [Contexts: one agent, the person and each organization](#contexts-one-agent-the-person-and-each-organization)
|
|
16
|
+
- [Connecting a machine or a cloud to the estate](#connecting-a-machine-or-a-cloud-to-the-estate)
|
|
17
|
+
- [Sharing an agent into an organization](#sharing-an-agent-into-an-organization)
|
|
18
|
+
- [Running while the laptop is closed](#running-while-the-laptop-is-closed)
|
|
19
|
+
- [Selling an agent](#selling-an-agent)
|
|
20
|
+
- [The checklist](#the-checklist)
|
|
21
|
+
|
|
22
|
+
## The places
|
|
23
|
+
|
|
24
|
+
| Where | What it is | Typical agent |
|
|
25
|
+
|---|---|---|
|
|
26
|
+
| **This machine** | the person's computer, Fabric and its services local; free and open source | a coding helper, a personal assistant that may stop when the laptop sleeps |
|
|
27
|
+
| **Personal cloud** | the person's own always-on machine in PassionCode's cloud (or the same stack self-hosted), one more machine of their estate | an agent that answers mail at night, a scheduled digest, a bot |
|
|
28
|
+
| **Organization** | the organization's cloud, its members' machines enrolled into it, its own server holding members, grants and usage | a support agent, an internal analyst, an agent the organization bought |
|
|
29
|
+
| **Enterprise** | an organization's dedicated cloud with personal onboarding | the same agents under the enterprise's own boundary |
|
|
30
|
+
|
|
31
|
+
Every step up is paid as cloud only: the person or the organization pays for the cloud its agents run in, and the
|
|
32
|
+
order says which hosting it holds (`personal-cloud`, `org-cloud`, `enterprise-cloud` in `entitlement/1`). An agent never
|
|
33
|
+
checks a price; it may read whether its context's entitlement is current and degrade honestly when it is not.
|
|
34
|
+
|
|
35
|
+
## Contexts: one agent, the person and each organization
|
|
36
|
+
|
|
37
|
+
A context is `personal` or `org:<orgId>`, compared exactly as written. Design every agent as if it will run in more
|
|
38
|
+
than one:
|
|
39
|
+
|
|
40
|
+
- **One instance per context.** On a machine an agent runs once per (agent, context). The personal instance and an
|
|
41
|
+
organization's instance are two instances with two state folders, two journals and two sets of secrets; never one
|
|
42
|
+
process that switches. In the estate record a placement names its `context`, and an organization's placement names
|
|
43
|
+
the share grant it runs under (FAC-SEM-074, FAC-SEM-111).
|
|
44
|
+
- **Secrets stay in their context.** An organization's instance fills its secret slots from the organization's own
|
|
45
|
+
machine and vault; a personal secret never reaches it, and the person's personal keys never pay for organization
|
|
46
|
+
work.
|
|
47
|
+
- **Spend and usage stay in their context.** Every call is metered under the grant it runs under; the organization
|
|
48
|
+
sees its instance's usage (`grant.usage`) and nothing of the person's personal work.
|
|
49
|
+
- **Contexts are never linked.** Nothing the agent sends to one organization names the person's personal context or
|
|
50
|
+
another organization: no shared ids, no shared logs, no "also used by" field.
|
|
51
|
+
- **Access is the grant, not a label.** What an organization's instance may do is its grant's capabilities, effect
|
|
52
|
+
ceiling, data classes, spend windows and expiry. A named level ("read only") is a preset that fills those fields.
|
|
53
|
+
|
|
54
|
+
## Connecting a machine or a cloud to the estate
|
|
55
|
+
|
|
56
|
+
A person's machines form their estate; an estate record signed with the person's passkey lists every machine, its
|
|
57
|
+
keys, and what runs where. A new machine joins only when a passkey-signed revision lists it:
|
|
58
|
+
|
|
59
|
+
- **Nearby** (a laptop, a phone): the two machines show the same six-digit comparison code; the person confirms it.
|
|
60
|
+
- **Headless** (a cloud machine, a server): Fabric issues an `enroll-token/1`, valid for at most 15 minutes and one use.
|
|
61
|
+
The machine reads it from stdin or a file only its user can read, never from a command-line argument, a URL or a
|
|
62
|
+
log, proves its key with it, and waits until the revision that lists it is signed. The token gives no trust by
|
|
63
|
+
itself. The kit's `fabric_ceremonies.py` checks a token (building-fabric-services, *The estate ceremonies*).
|
|
64
|
+
- **An organization's machine** enrolls into the organization's server: a device certificate names the organization
|
|
65
|
+
(`org.id`), and the machine's collector routes each context's events only to the server of that context.
|
|
66
|
+
|
|
67
|
+
Removing a machine or replacing its key is a revision that revokes what it drops in the same revision (FAC-SEM-114).
|
|
68
|
+
An agent service that applies the estate record verifies each revision with its parent before trusting it.
|
|
69
|
+
|
|
70
|
+
## Sharing an agent into an organization
|
|
71
|
+
|
|
72
|
+
The person's own agent can work for an organization without being copied into it:
|
|
73
|
+
|
|
74
|
+
1. Fabric writes a **share grant** into the organization: `context: org:<orgId>`, id `urn:fabric:share:` and 32 random
|
|
75
|
+
hex digits, one agent (`agentRef`) for its whole life, a window, the capabilities and spend the organization may
|
|
76
|
+
use. Moving the share to another agent revokes the grant and mints a new id.
|
|
77
|
+
2. The person's node sends the organization a **share registration**, so its server knows which agent the grant runs.
|
|
78
|
+
3. The instance placed in that context runs under the grant; its daily `grant.usage` goes to the organization's
|
|
79
|
+
server, carrying the grant's own context.
|
|
80
|
+
|
|
81
|
+
The kit checks the grant and the usage event (`fabric_share.py`). Revoking the grant stops calls at once where they are
|
|
82
|
+
checked, and removes the instance from the next revision.
|
|
83
|
+
|
|
84
|
+
## Running while the laptop is closed
|
|
85
|
+
|
|
86
|
+
A cloud agent keeps working with the laptop closed only if everything it needs is in the cloud: its worker, its
|
|
87
|
+
secrets, its data, and a hub that can admit calls. The local Fabric hub is not a cloud hub. Design for it:
|
|
88
|
+
|
|
89
|
+
- Declare what each capability needs and where it is; a capability that needs the person's machine reports
|
|
90
|
+
`pending` or `unavailable` instead of pretending, and queues within a deadline or declines.
|
|
91
|
+
- Never charge for work it cannot deliver on the promised terms.
|
|
92
|
+
- A test that passed on fixtures says nothing about uptime; measure the installed agent in its cloud.
|
|
93
|
+
|
|
94
|
+
## Selling an agent
|
|
95
|
+
|
|
96
|
+
- **A paid agent** runs in PassionCode's cloud inside its developer's organization (`org:<developer>`); each customer
|
|
97
|
+
organization reaches it through its own credential, which is the credential of an external grant, metered per
|
|
98
|
+
customer. The developer sets the price; the platform earns the cloud.
|
|
99
|
+
- **A partner** builds agents for a company and delivers them as a setup: each agent its own signed package, and one
|
|
100
|
+
organization skill set that requires them, all signed with the partner's key (building-fabric-services, *package*,
|
|
101
|
+
*A partner's setup for a company*). The company pays for the cloud; the partner's own work is between them.
|
|
102
|
+
- Whatever is sold: one signed `fabric-package/1` per version, no secret in it, every effect declared, and the agent's
|
|
103
|
+
spend under the customer's grant, never under the developer's personal key.
|
|
104
|
+
|
|
105
|
+
## The checklist
|
|
106
|
+
|
|
107
|
+
- Where does each instance run, and in which context? Write it in the knowledge pack.
|
|
108
|
+
- Does any state, secret, log line or cache key cross contexts? It must not.
|
|
109
|
+
- Which capabilities need the person's machine, and what do they answer when it is off?
|
|
110
|
+
- Who pays for each call (which grant, which key)? The person's personal key never pays for an organization.
|
|
111
|
+
- If it joins machines or applies the estate record: tokens from stdin or a 0600 file only, revisions verified with
|
|
112
|
+
their parent.
|
|
@@ -66,7 +66,7 @@ WATCH_MAX_BACKOFF_S = 900
|
|
|
66
66
|
SESSION_ID = re.compile(r"[A-Za-z0-9._:-]{1,128}")
|
|
67
67
|
LOOPBACK_ORIGIN = re.compile(r"http://127\.0\.0\.1:(\d{1,5})")
|
|
68
68
|
LOCAL_ORIGIN = re.compile(r'"origin": "http://(?:127\.0\.0\.1|localhost)')
|
|
69
|
-
VERSION = "0.
|
|
69
|
+
VERSION = "0.37.0"
|
|
70
70
|
HOSTS = {"claude": "Claude Code", "codex": "Codex", "kimi": "Kimi Code",
|
|
71
71
|
"hermes": "Hermes", "opencode": "OpenCode", "openclaw": "OpenClaw", "pi": "Pi"}
|
|
72
72
|
NATIVE_PLUGIN_HOSTS = frozenset(("hermes", "opencode", "openclaw", "pi"))
|