@tomflow/chatloop-tools 0.9.63 → 0.9.64
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/README.md +13 -1
- package/index.mjs +7 -7
- package/lib/context-control-run.mjs +23 -5
- package/lib/extension-proxy.mjs +16 -7
- package/lib/native-owner-v2.mjs +128 -0
- package/lib/release-health-checks.mjs +29 -5
- package/lib/trace-gateway.mjs +3 -1
- package/package.json +2 -12
- package/providers/extension.mjs +59 -16
- package/node_modules/@tomflow/chatloop-context/README.md +0 -240
- package/node_modules/@tomflow/chatloop-context/bin/cli.mjs +0 -48
- package/node_modules/@tomflow/chatloop-context/capabilities/approval.mjs +0 -151
- package/node_modules/@tomflow/chatloop-context/capabilities/context.mjs +0 -376
- package/node_modules/@tomflow/chatloop-context/capabilities/document.mjs +0 -266
- package/node_modules/@tomflow/chatloop-context/capabilities/evidence.mjs +0 -134
- package/node_modules/@tomflow/chatloop-context/capabilities/presentation.mjs +0 -82
- package/node_modules/@tomflow/chatloop-context/capabilities/project.mjs +0 -349
- package/node_modules/@tomflow/chatloop-context/capabilities/sdk.mjs +0 -72
- package/node_modules/@tomflow/chatloop-context/capabilities/start.mjs +0 -73
- package/node_modules/@tomflow/chatloop-context/capabilities/task.mjs +0 -507
- package/node_modules/@tomflow/chatloop-context/capabilities.generated.mjs +0 -11
- package/node_modules/@tomflow/chatloop-context/docs/interfaces.md +0 -192
- package/node_modules/@tomflow/chatloop-context/docs/operator-and-migration.md +0 -277
- package/node_modules/@tomflow/chatloop-context/index.mjs +0 -236
- package/node_modules/@tomflow/chatloop-context/lib/api-log.mjs +0 -86
- package/node_modules/@tomflow/chatloop-context/lib/approval-policy.mjs +0 -77
- package/node_modules/@tomflow/chatloop-context/lib/capability-catalog.generated.json +0 -1989
- package/node_modules/@tomflow/chatloop-context/lib/capability-router.mjs +0 -69
- package/node_modules/@tomflow/chatloop-context/lib/cli-commands.mjs +0 -285
- package/node_modules/@tomflow/chatloop-context/lib/context-cli.mjs +0 -298
- package/node_modules/@tomflow/chatloop-context/lib/context-migration.mjs +0 -286
- package/node_modules/@tomflow/chatloop-context/lib/core/context.mjs +0 -115
- package/node_modules/@tomflow/chatloop-context/lib/core/evidence.mjs +0 -51
- package/node_modules/@tomflow/chatloop-context/lib/core/health.mjs +0 -75
- package/node_modules/@tomflow/chatloop-context/lib/core/migration.mjs +0 -262
- package/node_modules/@tomflow/chatloop-context/lib/core/project.mjs +0 -246
- package/node_modules/@tomflow/chatloop-context/lib/core/review.mjs +0 -147
- package/node_modules/@tomflow/chatloop-context/lib/core/run-cancel.mjs +0 -54
- package/node_modules/@tomflow/chatloop-context/lib/core/run.mjs +0 -375
- package/node_modules/@tomflow/chatloop-context/lib/core/store.mjs +0 -397
- package/node_modules/@tomflow/chatloop-context/lib/core/task.mjs +0 -183
- package/node_modules/@tomflow/chatloop-context/lib/line-review.mjs +0 -13
- package/node_modules/@tomflow/chatloop-context/lib/methods.mjs +0 -111
- package/node_modules/@tomflow/chatloop-context/lib/operations.mjs +0 -107
- package/node_modules/@tomflow/chatloop-context/lib/orphan-operator.mjs +0 -118
- package/node_modules/@tomflow/chatloop-context/lib/process-inventory.mjs +0 -20
- package/node_modules/@tomflow/chatloop-context/lib/project-branch.mjs +0 -316
- package/node_modules/@tomflow/chatloop-context/lib/project-diagnostic.mjs +0 -153
- package/node_modules/@tomflow/chatloop-context/lib/project-guards.mjs +0 -19
- package/node_modules/@tomflow/chatloop-context/lib/project-store.mjs +0 -117
- package/node_modules/@tomflow/chatloop-context/lib/trusted-run.mjs +0 -97
- package/node_modules/@tomflow/chatloop-context/lib/workspace-operator.mjs +0 -169
- package/node_modules/@tomflow/chatloop-context/package.json +0 -40
- package/node_modules/@tomflow/chatloop-context/scripts/build-capabilities.mjs +0 -114
- package/node_modules/@tomflow/chatloop-extension/README.md +0 -124
- package/node_modules/@tomflow/chatloop-extension/actions.generated.mjs +0 -13
- package/node_modules/@tomflow/chatloop-extension/bin/cli.mjs +0 -153
- package/node_modules/@tomflow/chatloop-extension/bin/native-host.mjs +0 -207
- package/node_modules/@tomflow/chatloop-extension/capabilities/chat_dom.mjs +0 -1
- package/node_modules/@tomflow/chatloop-extension/capabilities/chat_screenshot.mjs +0 -1
- package/node_modules/@tomflow/chatloop-extension/capabilities/chat_text.mjs +0 -1
- package/node_modules/@tomflow/chatloop-extension/capabilities/clean.mjs +0 -1
- package/node_modules/@tomflow/chatloop-extension/capabilities/continue.mjs +0 -1
- package/node_modules/@tomflow/chatloop-extension/capabilities/entry_test.mjs +0 -1
- package/node_modules/@tomflow/chatloop-extension/capabilities/handoff.mjs +0 -1
- package/node_modules/@tomflow/chatloop-extension/capabilities/reload.mjs +0 -1
- package/node_modules/@tomflow/chatloop-extension/capabilities/session.mjs +0 -1
- package/node_modules/@tomflow/chatloop-extension/capabilities/start.mjs +0 -1
- package/node_modules/@tomflow/chatloop-extension/capabilities/status.mjs +0 -1
- package/node_modules/@tomflow/chatloop-extension/extension/actions/clean.js +0 -123
- package/node_modules/@tomflow/chatloop-extension/extension/actions/common.js +0 -183
- package/node_modules/@tomflow/chatloop-extension/extension/actions/continue.js +0 -340
- package/node_modules/@tomflow/chatloop-extension/extension/actions/dom.js +0 -2
- package/node_modules/@tomflow/chatloop-extension/extension/actions/entry_test.js +0 -241
- package/node_modules/@tomflow/chatloop-extension/extension/actions/handoff.js +0 -393
- package/node_modules/@tomflow/chatloop-extension/extension/actions/index.js +0 -2
- package/node_modules/@tomflow/chatloop-extension/extension/actions/model-intent.js +0 -56
- package/node_modules/@tomflow/chatloop-extension/extension/actions/read-mode.js +0 -9
- package/node_modules/@tomflow/chatloop-extension/extension/actions/reload.js +0 -20
- package/node_modules/@tomflow/chatloop-extension/extension/actions/screenshot.js +0 -77
- package/node_modules/@tomflow/chatloop-extension/extension/actions/session.js +0 -52
- package/node_modules/@tomflow/chatloop-extension/extension/actions/start.js +0 -295
- package/node_modules/@tomflow/chatloop-extension/extension/actions/status.js +0 -24
- package/node_modules/@tomflow/chatloop-extension/extension/actions/text.js +0 -2
- package/node_modules/@tomflow/chatloop-extension/extension/background.js +0 -17
- package/node_modules/@tomflow/chatloop-extension/extension/clean.html +0 -5
- package/node_modules/@tomflow/chatloop-extension/extension/content.js +0 -40
- package/node_modules/@tomflow/chatloop-extension/extension/continue.html +0 -9
- package/node_modules/@tomflow/chatloop-extension/extension/dom.html +0 -17
- package/node_modules/@tomflow/chatloop-extension/extension/entry_test.html +0 -6
- package/node_modules/@tomflow/chatloop-extension/extension/handoff.html +0 -9
- package/node_modules/@tomflow/chatloop-extension/extension/loop/action-catalog.generated.js +0 -2
- package/node_modules/@tomflow/chatloop-extension/extension/loop/api-aspect.generated.js +0 -275
- package/node_modules/@tomflow/chatloop-extension/extension/loop/api-observation-queue.generated.js +0 -84
- package/node_modules/@tomflow/chatloop-extension/extension/loop/core.js +0 -107
- package/node_modules/@tomflow/chatloop-extension/extension/loop/index.js +0 -36
- package/node_modules/@tomflow/chatloop-extension/extension/loop/observer-approval.js +0 -299
- package/node_modules/@tomflow/chatloop-extension/extension/loop/observer-inspect.js +0 -144
- package/node_modules/@tomflow/chatloop-extension/extension/loop/observer-poll.js +0 -171
- package/node_modules/@tomflow/chatloop-extension/extension/loop/observer-recovery.js +0 -109
- package/node_modules/@tomflow/chatloop-extension/extension/loop/observer.js +0 -154
- package/node_modules/@tomflow/chatloop-extension/extension/loop/resources.js +0 -259
- package/node_modules/@tomflow/chatloop-extension/extension/manifest.json +0 -42
- package/node_modules/@tomflow/chatloop-extension/extension/popup.html +0 -25
- package/node_modules/@tomflow/chatloop-extension/extension/popup.js +0 -99
- package/node_modules/@tomflow/chatloop-extension/extension/reload.html +0 -17
- package/node_modules/@tomflow/chatloop-extension/extension/screenshot.html +0 -17
- package/node_modules/@tomflow/chatloop-extension/extension/session.html +0 -6
- package/node_modules/@tomflow/chatloop-extension/extension/start.html +0 -6
- package/node_modules/@tomflow/chatloop-extension/extension/status.html +0 -6
- package/node_modules/@tomflow/chatloop-extension/extension/text.html +0 -17
- package/node_modules/@tomflow/chatloop-extension/extension/worker/action-result.js +0 -136
- package/node_modules/@tomflow/chatloop-extension/extension/worker/action-take.js +0 -218
- package/node_modules/@tomflow/chatloop-extension/extension/worker/admission.js +0 -124
- package/node_modules/@tomflow/chatloop-extension/extension/worker/adopt-prepare.js +0 -296
- package/node_modules/@tomflow/chatloop-extension/extension/worker/adopt-recovery.js +0 -186
- package/node_modules/@tomflow/chatloop-extension/extension/worker/adopt-result.js +0 -126
- package/node_modules/@tomflow/chatloop-extension/extension/worker/bootstrap.js +0 -230
- package/node_modules/@tomflow/chatloop-extension/extension/worker/manual.js +0 -163
- package/node_modules/@tomflow/chatloop-extension/extension/worker/readiness.js +0 -345
- package/node_modules/@tomflow/chatloop-extension/extension/worker/router.js +0 -192
- package/node_modules/@tomflow/chatloop-extension/extension/worker/scheduler.js +0 -161
- package/node_modules/@tomflow/chatloop-extension/extension/worker/session-control.js +0 -75
- package/node_modules/@tomflow/chatloop-extension/extension/worker/turn-failure.js +0 -197
- package/node_modules/@tomflow/chatloop-extension/extension/worker/turn-finished.js +0 -205
- package/node_modules/@tomflow/chatloop-extension/index.mjs +0 -71
- package/node_modules/@tomflow/chatloop-extension/lib/action-routing.mjs +0 -19
- package/node_modules/@tomflow/chatloop-extension/lib/api-observation-queue.mjs +0 -82
- package/node_modules/@tomflow/chatloop-extension/lib/bridge.mjs +0 -303
- package/node_modules/@tomflow/chatloop-extension/lib/browser-launch.mjs +0 -89
- package/node_modules/@tomflow/chatloop-extension/lib/context-binding.mjs +0 -45
- package/node_modules/@tomflow/chatloop-extension/lib/context-ipc.mjs +0 -115
- package/node_modules/@tomflow/chatloop-extension/lib/owner-evidence.mjs +0 -75
- package/node_modules/@tomflow/chatloop-extension/lib/session-file.mjs +0 -185
- package/node_modules/@tomflow/chatloop-extension/package.json +0 -38
- package/node_modules/@tomflow/chatloop-extension/scripts/build-actions.mjs +0 -138
- package/node_modules/@tomflow/chatloop-trace/README.md +0 -118
- package/node_modules/@tomflow/chatloop-trace/events/context.api.mjs +0 -23
- package/node_modules/@tomflow/chatloop-trace/events/typed.api.call.mjs +0 -22
- package/node_modules/@tomflow/chatloop-trace/events.generated.mjs +0 -4
- package/node_modules/@tomflow/chatloop-trace/index.mjs +0 -59
- package/node_modules/@tomflow/chatloop-trace/lib/api-aspect.mjs +0 -273
- package/node_modules/@tomflow/chatloop-trace/lib/trace-reader.mjs +0 -308
- package/node_modules/@tomflow/chatloop-trace/lib/trace-retention.mjs +0 -140
- package/node_modules/@tomflow/chatloop-trace/lib/trace.mjs +0 -236
- package/node_modules/@tomflow/chatloop-trace/package.json +0 -30
- package/node_modules/@tomflow/chatloop-trace/scripts/build-events.mjs +0 -68
- package/node_modules/ps-list/index.d.ts +0 -76
- package/node_modules/ps-list/index.js +0 -366
- package/node_modules/ps-list/license +0 -9
- package/node_modules/ps-list/package.json +0 -44
- package/node_modules/ps-list/readme.md +0 -56
- package/node_modules/ps-list/vendor/fastlist-0.3.0-x64.exe +0 -0
- package/node_modules/ps-list/vendor/fastlist-0.3.0-x86.exe +0 -0
|
@@ -1,240 +0,0 @@
|
|
|
1
|
-
# @tomflow/chatloop-context
|
|
2
|
-
|
|
3
|
-
One authoritative per-Project SQLite Context Store for **Project / Task / R/P Review /
|
|
4
|
-
Run Permit / Checkpoint / CAS / Receipt**. This package does **not** own the
|
|
5
|
-
Chrome Session Owner, user-message evidence collection, Trace, MCP Supervisor,
|
|
6
|
-
execution workflow or external source discovery.
|
|
7
|
-
|
|
8
|
-
## Exactly two npm access points
|
|
9
|
-
|
|
10
|
-
| Entry | npm declaration | Who uses it | Purpose |
|
|
11
|
-
| --- | --- | --- | --- |
|
|
12
|
-
| **Module entry** | `exports["."] = "./index.mjs"` | SDK clients, Tools MCP, Native/Operator adapters | All importable functions, clearly separated by role |
|
|
13
|
-
| **Executable entry** | `bin["chatloop-context"] = "./bin/cli.mjs"` | Pinned Tools CLI process or explicitly authorized local operator | Bounded `request --json`, method discovery and reviewed operator commands |
|
|
14
|
-
|
|
15
|
-
**No `./protocol`, `./methods`, `./operations`, `./migration`,
|
|
16
|
-
`./admin` or `./cli` npm subpath is exported.** Internal files in
|
|
17
|
-
`lib/` are implementation, not an integration contract. The installed CLI
|
|
18
|
-
comes from npm `bin`, not a second importable npm module.
|
|
19
|
-
|
|
20
|
-
**Implementation boundary:** No module in `lib/**` imports another `lib/**`
|
|
21
|
-
implementation. The sole SDK root `index.mjs` injects named API capabilities
|
|
22
|
-
through three lazy compositions: Business, Trusted Native and Local Operator.
|
|
23
|
-
`bin/cli.mjs` imports only `index.mjs` and invokes the reviewed operator
|
|
24
|
-
`runLocalCliCommand()` API; it does not import implementation files.
|
|
25
|
-
|
|
26
|
-
```text
|
|
27
|
-
index.mjs (sole SDK entry and dependency assembler)
|
|
28
|
-
|-- Build manifest -> capability contracts and generic dispatcher
|
|
29
|
-
|-- Business API -> Core / Project / Task / Review / Context
|
|
30
|
-
|-- Trusted API -> Run / Permit (signed-IPC consumer)
|
|
31
|
-
+-- Operator API -> Workspace / Migration / CLI commands
|
|
32
|
-
bin/cli.mjs (sole executable entry) -> index.mjs -> Operator API
|
|
33
|
-
lib/** (private implementations) <- named capabilities injected by index.mjs
|
|
34
|
-
Core -> one SQLite handle, CAS transaction and durable receipt owner
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
A module knows only its injected API contract, never the source file or internal
|
|
38
|
-
structure of the provider. Modules do not import `index.mjs` in reverse, so
|
|
39
|
-
no circular npm import is created. An import, `npx` invocation or module loader
|
|
40
|
-
alone **does not grant** Project ACL, Native Permit or operator permission.
|
|
41
|
-
|
|
42
|
-
## Module exports: always import only from the package root
|
|
43
|
-
|
|
44
|
-
```js
|
|
45
|
-
import {
|
|
46
|
-
CONTEXT_CONTRACT, CONTEXT_PACKAGE_VERSION,
|
|
47
|
-
requestContext, contextGateway, loadTrustedRuntime, loadLocalOperator,
|
|
48
|
-
subscribeContextApiLog
|
|
49
|
-
} from '@tomflow/chatloop-context';
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
| Surface | Exact exported names | Trust boundary |
|
|
53
|
-
| --- | --- | --- |
|
|
54
|
-
| **Public SDK** | `CONTEXT_CONTRACT`, `CONTEXT_PACKAGE_VERSION`, `requestContext` | Strict Method Catalog; Project ACL; CAS / receipt |
|
|
55
|
-
| **Tools MCP adapter** | `contextGateway` namespace (`tools`, `validate`, `allowedProjects`, `cliPath`) | The pinned package owns its own CLI path; caller cannot select arbitrary executable |
|
|
56
|
-
| **Trusted Native adapter** | `loadTrustedRuntime()` → `execute(command,args,native)` | Only a signed IPC verified Native projection is accepted by its consumer; Context validates domain command, Native fields, Project grant and CAS |
|
|
57
|
-
| **Local operator** | `loadLocalOperator()` → only `runLocalCliCommand` (CLI consumer) | Explicit reviewed CLI/TTY and verified Project/SourceUnit / backups |
|
|
58
|
-
| **Observability** | `subscribeContextApiLog(listener)` → `unsubscribe()` | Tools routes non-authoritative events to the existing Supervisor Trace writer |
|
|
59
|
-
|
|
60
|
-
`loadTrustedRuntime` and `loadLocalOperator` do not themselves authorize any
|
|
61
|
-
action. They organize trusted integrators behind **the same root**; they are
|
|
62
|
-
not ordinary model/MCP operations.
|
|
63
|
-
|
|
64
|
-
See [provider / consumer / dependency matrix](docs/interfaces.md) for the
|
|
65
|
-
**complete** cross-module reference. For exact method IDs, schemas and
|
|
66
|
-
semantics, use `sdk.methods.list` / `sdk.methods.describe` on the connected SDK.
|
|
67
|
-
|
|
68
|
-
## External API minimization (no compatibility surface)
|
|
69
|
-
|
|
70
|
-
The npm module exposes exactly seven names, and the ordinary Method Catalog
|
|
71
|
-
contains **34 current business operations** (no Legacy aliases). Public
|
|
72
|
-
JavaScript consumers must use `requestContext(args)`; discovery also uses
|
|
73
|
-
that same operation with `sdk.methods.list` / `sdk.methods.describe`.
|
|
74
|
-
There are no separately exported `listMethods` / `describeMethod` helpers.
|
|
75
|
-
|
|
76
|
-
The CLI is the *only* consumer of `loadLocalOperator()`, whose returned
|
|
77
|
-
namespace contains only `runLocalCliCommand`. Its migration, workspace,
|
|
78
|
-
SourceUnit and orphan-fence utilities stay private to the `index.mjs`
|
|
79
|
-
composition. `project.create`, `project.registryAuthority`, `project.get`,
|
|
80
|
-
`project.archive`, `task.get`, `task.archive`, and `evidence.detach` are **not**
|
|
81
|
-
public operations. For new projects use reviewed `chatloop-context project
|
|
82
|
-
register/init`; for Project/Task detail use `project.open` / `task.open`.
|
|
83
|
-
There is no version-1 forwarding or fallback. Clients must upgrade together
|
|
84
|
-
and verify the `chat-loop.context-sdk.v2` contract before use.
|
|
85
|
-
`project.list` and `task.list` always return a bounded page object,
|
|
86
|
-
respectively `{projects,incomplete,nextCursor,limit}` and
|
|
87
|
-
`{tasks,incomplete,nextCursor,limit}`, with `limit=30` by default. There is
|
|
88
|
-
no implicit full-array result when pagination arguments are omitted.
|
|
89
|
-
|
|
90
|
-
## Capability-based build composition
|
|
91
|
-
|
|
92
|
-
The stable npm/CLI/MCP entrypoints now compose **34 existing methods from
|
|
93
|
-
nine independent capability descriptors** in `capabilities/<group>.mjs`.
|
|
94
|
-
Each descriptor owns its method IDs, Schema, mode, version, and dispatch route.
|
|
95
|
-
To add an independent capability, create one new descriptor with a unique
|
|
96
|
-
group name; no edits to existing capabilities or the central router are needed.
|
|
97
|
-
|
|
98
|
-
`npm run build:capabilities` produces the deterministic
|
|
99
|
-
`capabilities.generated.mjs` (static imports) and
|
|
100
|
-
`lib/capability-catalog.generated.json` (strict metadata). The generated
|
|
101
|
-
catalog drives `sdk.methods.list/describe`, SDK validation, both MCP tool
|
|
102
|
-
schemas and CLI discovery. Build/check/pack fail when outputs
|
|
103
|
-
are missing or stale; runtime never scans arbitrary directories.
|
|
104
|
-
|
|
105
|
-
Existing Core writes continue to require the original Project authority,
|
|
106
|
-
MANAGED_RW, CAS and durable receipts. The new `module` route is limited to
|
|
107
|
-
authorized **read-only** Project access with a restricted document/material
|
|
108
|
-
read port; it does not expose a raw database, writer credential or Owner.
|
|
109
|
-
The scoped Store remains open until an asynchronous capability Promise settles,
|
|
110
|
-
then closes on both success and failure.
|
|
111
|
-
A future independently writable capability requires a separately reviewed
|
|
112
|
-
transaction/receipt contract, not a security bypass. No RAG implementation
|
|
113
|
-
or new business feature is included in this refactor.
|
|
114
|
-
|
|
115
|
-
The isolated additive `probe` test builds and routes a 35th method, verifies
|
|
116
|
-
its Project boundary, then removes it to recover the original 34 methods.
|
|
117
|
-
The compiler rejects unsafe writes and conflicting capability declarations.
|
|
118
|
-
|
|
119
|
-
## Context API logging — Proxy/AOP, no domain instrumentation
|
|
120
|
-
|
|
121
|
-
The exported `requestContext` intercepts **all 34 business operations**.
|
|
122
|
-
The same reusable `Proxy` intercepts `contextGateway.validate`,
|
|
123
|
-
`contextGateway.allowedProjects`, Trusted Native `execute`, and Local
|
|
124
|
-
Operator `runLocalCliCommand`. The package exports one consumed hook,
|
|
125
|
-
`subscribeContextApiLog(listener)`, for Tools to attach a best-effort sink.
|
|
126
|
-
|
|
127
|
-
Each call emits a sanitized
|
|
128
|
-
`{contract,callId,traceId,spanId,parentSpanId,api,surface,mode,projectRef,taskRef,phase,time,durationMs,errorCode}`
|
|
129
|
-
event with `BEGIN` followed by `OK` or `FAILED`. API calls
|
|
130
|
-
within one asynchronous chain inherit a soft `traceId`; every API gets its
|
|
131
|
-
own `spanId` and optional parent. The pinned child CLI inherits only an
|
|
132
|
-
opaque sanitized parent reference, never a permission or Owner credential.
|
|
133
|
-
Input bodies, credentials, paths and output values are never logged. Callbacks and CLI STDERR output
|
|
134
|
-
are deferred through a bounded best-effort queue (up to 4096 pending events),
|
|
135
|
-
so an observer cannot synchronously delay a business API. Log failures and
|
|
136
|
-
queue saturation cannot change the original result, Promise rejection,
|
|
137
|
-
CAS transaction or business receipt; they must not trigger retries.
|
|
138
|
-
Observations can be dropped when overloaded and are not durable evidence.
|
|
139
|
-
|
|
140
|
-
Context CLI emits structured STDERR log records without polluting its
|
|
141
|
-
single JSON stdout response. For a Context-authorized single Project, Tools
|
|
142
|
-
routes these observations into **one** existing Supervisor Trace v2
|
|
143
|
-
`events.jsonl` file even when the public Trace MCP is disabled. Reading via
|
|
144
|
-
`chat_loop_trace_diagnose` still requires independent Trace opt-in.
|
|
145
|
-
Records use fixed `event=context.api`, typed `api={name,surface,mode}`,
|
|
146
|
-
and correlated `traceId/spanId/parentSpanId` for nested API calls. For
|
|
147
|
-
root calls without an inherited parent, `traceId=callId`.
|
|
148
|
-
No second logging database or daemon is created. Without a connected Trace
|
|
149
|
-
sink, CLI STDERR remains observable but no permanent retention is claimed.
|
|
150
|
-
These are soft execution observations, never R/P approval, browser-send
|
|
151
|
-
proof or Native Owner evidence.
|
|
152
|
-
|
|
153
|
-
## Minimal usage
|
|
154
|
-
|
|
155
|
-
Node **20+** may import the root and discover methods; SQLite access, runtime
|
|
156
|
-
and operator work require **Node 24+**. The package does not create a daemon.
|
|
157
|
-
|
|
158
|
-
```js
|
|
159
|
-
import {requestContext} from '@tomflow/chatloop-context';
|
|
160
|
-
|
|
161
|
-
const capabilities=await requestContext({operation:'sdk.methods.list',view:'groups'});
|
|
162
|
-
const schema=(await requestContext({operation:'sdk.methods.describe',
|
|
163
|
-
methodId:'project.open'})).inputSchema;
|
|
164
|
-
const project=await requestContext({operation:'project.open',projectId:'demo'});
|
|
165
|
-
console.log(project.authority,project.storeEpoch);
|
|
166
|
-
```
|
|
167
|
-
|
|
168
|
-
A public SDK call is accepted only for configured, explicitly authorized
|
|
169
|
-
Project IDs. A normal adapter uses `CHAT_LOOP_CONTEXT_ALLOWED_PROJECTS` plus
|
|
170
|
-
**exactly one** of `CHAT_LOOP_CONTEXT_ROOT` (one SQLite per Project) or the
|
|
171
|
-
explicitly controlled legacy `CHAT_LOOP_CONTEXT_DB` migration mode. Never
|
|
172
|
-
set both roots.
|
|
173
|
-
|
|
174
|
-
Write operations require relevant `expectedStoreEpoch`, revision CAS,
|
|
175
|
-
`writeRequestId`, and for active-run updates the real RunRef/credential.
|
|
176
|
-
**UNKNOWN** result: check `context.request.status` using the **original**
|
|
177
|
-
request ID; never invent a second write attempt.
|
|
178
|
-
|
|
179
|
-
## CLI lifecycle
|
|
180
|
-
|
|
181
|
-
The npm executable is `chatloop-context`, installed by a fixed dependency
|
|
182
|
-
or invoked separately through a **pinned, available** npm version:
|
|
183
|
-
|
|
184
|
-
```sh
|
|
185
|
-
npm install --save-exact "@tomflow/chatloop-context@${VERIFIED_CONTEXT_VERSION:?set-exact-verified-version}"
|
|
186
|
-
chatloop-context methods groups
|
|
187
|
-
chatloop-context methods list project
|
|
188
|
-
chatloop-context methods describe project.open
|
|
189
|
-
printf '%s
|
|
190
|
-
' '{"operation":"sdk.methods.list","view":"groups"}' | chatloop-context request --json
|
|
191
|
-
```
|
|
192
|
-
|
|
193
|
-
The CLI emits a **single structured result**:
|
|
194
|
-
`{contract,packageVersion,ok,result}` or
|
|
195
|
-
`{contract,packageVersion,ok:false,error:{code}}`. The binary is an
|
|
196
|
-
independent one-shot process; Tools starts its **pinned** CLI with
|
|
197
|
-
`shell:false` and does not resolve a new `npx` release per request.
|
|
198
|
-
|
|
199
|
-
Operator-only commands (`project register/bind/receipt/init`, `admin <action>`, recovery,
|
|
200
|
-
source audit and sealing, orphan fence, etc.) enforce separate local
|
|
201
|
-
authorization, exact input/revision and where required real TTY review.
|
|
202
|
-
See [operator and migration procedures](docs/operator-and-migration.md).
|
|
203
|
-
|
|
204
|
-
## Actual consumers and dependencies
|
|
205
|
-
|
|
206
|
-
- **Consumers:** Project/Delivery/Continuity → Tools MCP
|
|
207
|
-
`chat_loop_context_get/mutate` → pinned Context CLI; Tools Registry
|
|
208
|
-
adapter → Context authority/Task reads; Extension Worker → Native Host
|
|
209
|
-
→ signed Tools Supervisor → Context trusted runtime; local reviewed
|
|
210
|
-
operator → CLI.
|
|
211
|
-
- **npm dependencies:** `@tomflow/chatloop-extension` (official verified
|
|
212
|
-
Owner evidence API) and `ps-list` (cross-platform process enumeration).
|
|
213
|
-
Both are declared, pinned, and consumed through named APIs; SQLite,
|
|
214
|
-
filesystem and crypto remain Node built-ins.
|
|
215
|
-
- **Owner boundary:** Context no longer constructs the Extension installation
|
|
216
|
-
path or reads the private Native Session file. Its `fence-orphan`
|
|
217
|
-
operator asks Extension to independently verify terminal IDLE and Owner
|
|
218
|
-
mismatch before and after review. The process observation API is not
|
|
219
|
-
itself a durable stop receipt.
|
|
220
|
-
|
|
221
|
-
Read [interfaces.md](docs/interfaces.md) for the exact source files, calls,
|
|
222
|
-
ownership boundaries and known coupling risks.
|
|
223
|
-
|
|
224
|
-
## Deployment is separate from source
|
|
225
|
-
|
|
226
|
-
The source version declared in [`package.json`](package.json) does **not** establish the connected MCP
|
|
227
|
-
version. Verify the real `sdk.methods.list` response, Node runtime,
|
|
228
|
-
pinned Tools dependency, package bytes and Project authority before any
|
|
229
|
-
separately authorized installation. Source refactoring does **not** migrate
|
|
230
|
-
production SQLite, change Chrome Owner or approve R/P.
|
|
231
|
-
|
|
232
|
-
```sh
|
|
233
|
-
npm run build:capabilities:check
|
|
234
|
-
npm test
|
|
235
|
-
```
|
|
236
|
-
|
|
237
|
-
Each capability owns its API contract in `capabilities/<group>.mjs`;
|
|
238
|
-
there is no separate API inventory document. To discover exact available
|
|
239
|
-
methods and their schemas, use `sdk.methods.list` / `sdk.methods.describe`
|
|
240
|
-
from the installed SDK. Never substitute local source docs for deployed contracts.
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
// The ONLY shell-visible entrypoint; all capabilities come from the root SDK.
|
|
3
|
-
import {CONTEXT_CONTRACT,CONTEXT_PACKAGE_VERSION,
|
|
4
|
-
requestContext,loadLocalOperator} from '../index.mjs';
|
|
5
|
-
// This short-lived Context CLI is the only process that emits the SDK's
|
|
6
|
-
// structured audit records on STDERR. Other npm consumers use subscriptions.
|
|
7
|
-
process.env.CHAT_LOOP_CONTEXT_API_LOG_STDERR='1';
|
|
8
|
-
const fail=code=>Object.assign(new Error(code),{code});
|
|
9
|
-
const limit=5*1024*1024;
|
|
10
|
-
const output=value=>process.stdout.write(JSON.stringify({
|
|
11
|
-
contract:CONTEXT_CONTRACT,packageVersion:CONTEXT_PACKAGE_VERSION,...value
|
|
12
|
-
})+'\n');
|
|
13
|
-
async function readJson(){
|
|
14
|
-
let bytes=0,parts=[];
|
|
15
|
-
for await(const chunk of process.stdin){
|
|
16
|
-
bytes+=chunk.length;
|
|
17
|
-
if(bytes>limit)throw fail('REQUEST_TOO_LARGE');
|
|
18
|
-
parts.push(chunk);
|
|
19
|
-
}
|
|
20
|
-
if(!bytes)throw fail('REQUEST_REQUIRED');
|
|
21
|
-
try{return JSON.parse(Buffer.concat(parts).toString('utf8'))}
|
|
22
|
-
catch{throw fail('INVALID_JSON')}
|
|
23
|
-
}
|
|
24
|
-
const args=process.argv.slice(2);
|
|
25
|
-
try{
|
|
26
|
-
const node24=Number(process.versions.node.split('.')[0])>=24;
|
|
27
|
-
if(!node24&&args[0]!=='methods')throw fail('CONTEXT_RUNTIME_UNSUPPORTED');
|
|
28
|
-
let value;
|
|
29
|
-
if(!node24){
|
|
30
|
-
const [command,sub,...rest]=args;
|
|
31
|
-
if(command==='methods'&&sub==='list'&&rest.length<=1)
|
|
32
|
-
value=await requestContext({operation:'sdk.methods.list',...(rest[0]==='--json'?{}:rest[0]?{group:rest[0]}:{})});
|
|
33
|
-
else if(command==='methods'&&sub==='groups'&&rest.length<=1)
|
|
34
|
-
value=await requestContext({operation:'sdk.methods.list',view:'groups',...(rest[0]?{group:rest[0]}:{})});
|
|
35
|
-
else if(command==='methods'&&sub==='describe'&&rest.length===1)
|
|
36
|
-
value=await requestContext({operation:'sdk.methods.describe',methodId:rest[0]});
|
|
37
|
-
else throw fail('UNKNOWN_COMMAND');
|
|
38
|
-
}else{
|
|
39
|
-
const {runLocalCliCommand}=await loadLocalOperator();
|
|
40
|
-
value=await runLocalCliCommand(args,readJson);
|
|
41
|
-
}
|
|
42
|
-
output({ok:true,result:value});
|
|
43
|
-
}catch(error){
|
|
44
|
-
// Never leak arbitrary filesystem, SQLite, or user data in CLI errors.
|
|
45
|
-
const code=error.code||'CONTEXT_FAILED';
|
|
46
|
-
output({ok:false,error:{code:/^[A-Z0-9_]+$/.test(code)?code:'CONTEXT_FAILED'}});
|
|
47
|
-
process.exitCode=1;
|
|
48
|
-
}
|
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
// One self-contained Context capability contract. Registered at build time.
|
|
2
|
-
export const capability={
|
|
3
|
-
"id": "approval",
|
|
4
|
-
"version": 1,
|
|
5
|
-
"purpose": "Observe or revoke R/P decisions with actual user-turn evidence",
|
|
6
|
-
"startWith": "approval.observe",
|
|
7
|
-
"methods": [
|
|
8
|
-
{
|
|
9
|
-
"id": "approval.observe",
|
|
10
|
-
"group": "approval",
|
|
11
|
-
"mode": "write",
|
|
12
|
-
"description": "Record soft evidence of a real user decision on a displayed R/P version.",
|
|
13
|
-
"inputSchema": {
|
|
14
|
-
"type": "object",
|
|
15
|
-
"required": [
|
|
16
|
-
"operation",
|
|
17
|
-
"projectId",
|
|
18
|
-
"taskId",
|
|
19
|
-
"issueId",
|
|
20
|
-
"decision",
|
|
21
|
-
"sourceRole",
|
|
22
|
-
"userTurn",
|
|
23
|
-
"presentedAssistantRef",
|
|
24
|
-
"expectedTaskRevision",
|
|
25
|
-
"expectedStoreEpoch",
|
|
26
|
-
"writeRequestId"
|
|
27
|
-
],
|
|
28
|
-
"additionalProperties": false,
|
|
29
|
-
"properties": {
|
|
30
|
-
"operation": {
|
|
31
|
-
"const": "approval.observe"
|
|
32
|
-
},
|
|
33
|
-
"projectId": {
|
|
34
|
-
"type": "string",
|
|
35
|
-
"pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]{0,127}$"
|
|
36
|
-
},
|
|
37
|
-
"taskId": {
|
|
38
|
-
"type": "string",
|
|
39
|
-
"pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]{0,127}$"
|
|
40
|
-
},
|
|
41
|
-
"issueId": {
|
|
42
|
-
"type": "string",
|
|
43
|
-
"minLength": 8,
|
|
44
|
-
"maxLength": 64
|
|
45
|
-
},
|
|
46
|
-
"decision": {
|
|
47
|
-
"enum": [
|
|
48
|
-
"APPROVE",
|
|
49
|
-
"REJECT",
|
|
50
|
-
"REQUEST_CHANGE",
|
|
51
|
-
"CUSTOM"
|
|
52
|
-
]
|
|
53
|
-
},
|
|
54
|
-
"sourceRole": {
|
|
55
|
-
"const": "user"
|
|
56
|
-
},
|
|
57
|
-
"userTurn": {
|
|
58
|
-
"type": "string",
|
|
59
|
-
"minLength": 8,
|
|
60
|
-
"maxLength": 256
|
|
61
|
-
},
|
|
62
|
-
"presentedAssistantRef": {
|
|
63
|
-
"type": "string",
|
|
64
|
-
"minLength": 8,
|
|
65
|
-
"maxLength": 256
|
|
66
|
-
},
|
|
67
|
-
"expectedTaskRevision": {
|
|
68
|
-
"type": "integer",
|
|
69
|
-
"minimum": 1
|
|
70
|
-
},
|
|
71
|
-
"expectedStoreEpoch": {
|
|
72
|
-
"type": "string",
|
|
73
|
-
"minLength": 10,
|
|
74
|
-
"maxLength": 64
|
|
75
|
-
},
|
|
76
|
-
"writeRequestId": {
|
|
77
|
-
"type": "string",
|
|
78
|
-
"minLength": 8,
|
|
79
|
-
"maxLength": 128
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
},
|
|
83
|
-
"order": 27,
|
|
84
|
-
"route": {
|
|
85
|
-
"kind": "core",
|
|
86
|
-
"method": "observeApproval",
|
|
87
|
-
"params": [
|
|
88
|
-
"$args"
|
|
89
|
-
]
|
|
90
|
-
}
|
|
91
|
-
},
|
|
92
|
-
{
|
|
93
|
-
"id": "approval.revoke",
|
|
94
|
-
"group": "approval",
|
|
95
|
-
"mode": "write",
|
|
96
|
-
"description": "Invalidate earlier approvals at the correct task revision.",
|
|
97
|
-
"inputSchema": {
|
|
98
|
-
"type": "object",
|
|
99
|
-
"required": [
|
|
100
|
-
"operation",
|
|
101
|
-
"projectId",
|
|
102
|
-
"taskId",
|
|
103
|
-
"expectedTaskRevision",
|
|
104
|
-
"expectedApprovalRevision",
|
|
105
|
-
"expectedStoreEpoch",
|
|
106
|
-
"writeRequestId"
|
|
107
|
-
],
|
|
108
|
-
"additionalProperties": false,
|
|
109
|
-
"properties": {
|
|
110
|
-
"operation": {
|
|
111
|
-
"const": "approval.revoke"
|
|
112
|
-
},
|
|
113
|
-
"projectId": {
|
|
114
|
-
"type": "string",
|
|
115
|
-
"pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]{0,127}$"
|
|
116
|
-
},
|
|
117
|
-
"taskId": {
|
|
118
|
-
"type": "string",
|
|
119
|
-
"pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]{0,127}$"
|
|
120
|
-
},
|
|
121
|
-
"expectedTaskRevision": {
|
|
122
|
-
"type": "integer",
|
|
123
|
-
"minimum": 1
|
|
124
|
-
},
|
|
125
|
-
"expectedApprovalRevision": {
|
|
126
|
-
"type": "integer",
|
|
127
|
-
"minimum": 1
|
|
128
|
-
},
|
|
129
|
-
"expectedStoreEpoch": {
|
|
130
|
-
"type": "string",
|
|
131
|
-
"minLength": 10,
|
|
132
|
-
"maxLength": 64
|
|
133
|
-
},
|
|
134
|
-
"writeRequestId": {
|
|
135
|
-
"type": "string",
|
|
136
|
-
"minLength": 8,
|
|
137
|
-
"maxLength": 128
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
},
|
|
141
|
-
"order": 28,
|
|
142
|
-
"route": {
|
|
143
|
-
"kind": "core",
|
|
144
|
-
"method": "revokeApproval",
|
|
145
|
-
"params": [
|
|
146
|
-
"$args"
|
|
147
|
-
]
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
]
|
|
151
|
-
};
|