osuite 2.10.1 → 2.11.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.
@@ -0,0 +1,202 @@
1
+ # Native Tool Compatibility And Recovery
2
+
3
+ This opt-in API is introduced in 2.11.0; it is not part of 2.10.2. Confirm the
4
+ chosen version with `npm view osuite@2.11.0 version` before installing. A source
5
+ checkout alone does not establish npm availability or server compatibility;
6
+ consult the verified release record before enabling it for a workspace.
7
+
8
+ `osuite/governed-tools` is ESM and requires **Node 24 on POSIX**. It uses built-in
9
+ SQLite; it adds no production dependency. Existing `osuite` imports, CommonJS,
10
+ CLI, advisory MCP tools and Hook support are unchanged. Nothing is installed or
11
+ activated in a host by importing it.
12
+
13
+ ## What Changes In An Application
14
+
15
+ Keep your native tool name, JSON arguments, callback and successful result.
16
+ Configure a trusted mapping and a private journal once; give each business
17
+ operation a stable ID. The wrapper calls the original callback only after
18
+ current Studio admission. It does not ask the model to use a different tool.
19
+
20
+ Provision a new journal deliberately: construct once with
21
+ `initializeJournal: true`, then close it without running a tool. Normal
22
+ application starts use `false` (the default). A missing or uninitialized journal
23
+ then fails rather than quietly recreating operation history. Never leave the
24
+ initialization flag enabled as a restart/recovery shortcut.
25
+
26
+ ```js
27
+ import { createGovernedTools } from 'osuite/governed-tools';
28
+
29
+ const tools = createGovernedTools({
30
+ config: {
31
+ baseUrl: process.env.OSUITE_BASE_URL,
32
+ orgId: process.env.OSUITE_ORG_ID,
33
+ agentId: process.env.OSUITE_AGENT_ID,
34
+ runtimeId: 'sdk',
35
+ provider: 'sdk',
36
+ apiKey: process.env.OSUITE_API_KEY,
37
+ privateKeyBase64: process.env.OSUITE_PRIVATE_KEY_BASE64,
38
+ mode: 'enforce',
39
+ signatureMode: 'required',
40
+ guardFailureMode: 'block',
41
+ },
42
+ namespace: 'billing-service',
43
+ journalPath: '/absolute/private-directory/billing.sqlite',
44
+ initializeJournal: false,
45
+ bindings: {
46
+ 'ledger.append': {
47
+ revision: 'ledger-mapping-1',
48
+ describe: args => ({
49
+ action_type: 'api',
50
+ declared_goal: 'Append the specified billing ledger record',
51
+ systems_touched: ['billing-ledger'],
52
+ reversible: false,
53
+ input_summary: { target: args.target, amount: args.amount },
54
+ }),
55
+ },
56
+ },
57
+ });
58
+
59
+ try {
60
+ const result = await tools.run(
61
+ job.operationId,
62
+ { name: 'ledger.append', arguments: job.arguments },
63
+ ({ arguments: args }) => ledger.append(args),
64
+ { waitMs: 30000, signal: abortController.signal },
65
+ );
66
+ // The actual ledger result, not an OSuite-generated substitute.
67
+ consumeNativeResult(result);
68
+ } catch (error) {
69
+ if (error.code === 'AWAITING_APPROVAL') {
70
+ showExistingReview(error.status.actionId, error.status.reviewUrl);
71
+ // Resume this same operation later; do not create a replacement ID.
72
+ } else {
73
+ showExplicitFailure(error.code, error.status);
74
+ }
75
+ } finally {
76
+ tools.close();
77
+ }
78
+ ```
79
+
80
+ The description is an application-maintained semantic mapping, **not authority**.
81
+ Validate it against the real tool implementation. Include the consequential
82
+ target, operation, destination, amount/data boundary and relevant constraints;
83
+ the sample is not a universal banking policy. A signature proves who supplied
84
+ the mapping, not that the mapping is semantically complete. Studio still owns
85
+ the allow/hold/deny decision. Do not put secrets in `input_summary`: that bounded
86
+ description is sent to Studio even though full native arguments stay local.
87
+
88
+ Use a separately enrolled SDK/MCP identity with a current signing key. A Hook
89
+ credential is not interchangeable with an SDK credential. The new `sdk`/`mcp`
90
+ posture endpoint must be deployed server-side. Older servers fail explicitly;
91
+ there is no unsigned, offline, observe-mode or raw-client fallback. A configured
92
+ mandatory scoped policy is never ignored to make this wrapper work.
93
+ This profile does not implement assumption-capture workflows; a posture that
94
+ requires them is refused rather than silently reported as satisfied. Posture
95
+ is current client configuration, not a resource capability or proof that every
96
+ unsigned request to the server is prohibited. Actual signed action responses
97
+ and fresh admission are checked separately.
98
+
99
+ ## Connected MCP Client
100
+
101
+ ```js
102
+ import { wrapMcpClient } from 'osuite/governed-tools';
103
+ const governed = wrapMcpClient(alreadyConnectedMcpClient, tools);
104
+ const result = await governed.operation(job.operationId).callTool(
105
+ { name: 'ledger.append', arguments: job.arguments },
106
+ nativeResultSchema,
107
+ { signal: abortController.signal, timeout: 10000 },
108
+ );
109
+ ```
110
+
111
+ The supplied client's receiver, schema, allowed options and original returned
112
+ result are preserved. Its timeout is the native call timeout, not a new approval
113
+ wait budget. The adapter defaults to returning a held status promptly; invoke
114
+ the same operation after review. `governed.status(id)` reads existing status and
115
+ never executes or redeems an approval.
116
+
117
+ This bounded profile supports ordinary `callTool` with explicit `name` and
118
+ object `arguments`, and only `signal` / `timeout` options. Names and operation
119
+ IDs are 1-128 ASCII identifier characters (`A-Z`, `a-z`, digits, `_`, `.`, `-`),
120
+ must start with an alphanumeric character or `_`, and cannot contain `..`.
121
+ Inputs must be lossless JSON, at most 32 KiB, depth 16 and 8,192 nodes. Unsupported
122
+ accessors, proxy objects and prototype-sensitive keys (`__proto__`, `prototype`,
123
+ `constructor`) are rejected even when a native client might accept them.
124
+ Unsupported
125
+ metadata, tasks, streams, progress callbacks and arbitrary MCP requests are
126
+ rejected, not silently stripped. OAuth, discovery and connection setup remain
127
+ with your existing MCP client. This is not a universal MCP gateway certification.
128
+
129
+ ## Recovery Contract
130
+
131
+ An operation ID means one business intention, not equality of arguments or a
132
+ JSON-RPC request number. Persist it in your existing job record. Different IDs
133
+ with identical arguments remain different legitimate operations. Reusing an ID
134
+ with changed input or mapping is a conflict. Changing the namespace or identity
135
+ creates a different scope: never use that as a recovery shortcut.
136
+
137
+ | State / error | Required application behavior |
138
+ | --- | --- |
139
+ | `AWAITING_APPROVAL` | Show the existing review; resume the same ID and exact input. |
140
+ | `ALREADY_COMPLETED` | Do not execute again. Load business output from your own store. |
141
+ | `OPERATION_BUSY` | Another caller owns the transition; read status, do not invent an ID. |
142
+ | `OUTCOME_UNKNOWN` | Inspect the resource separately; do not automatically resend. |
143
+ | `POLICY_DENIED` / expiry / cancellation | Respect the terminal refusal. A new intention needs explicit operator action. |
144
+ | `CURRENT_AUTHORITY_UNAVAILABLE` | Restore current server/identity configuration; never fall back to ungoverned execution. |
145
+ | `JOURNAL_MISSING` / invalid journal | Restore the correct durable journal; do not initialize an empty replacement to replay old IDs. |
146
+ | `ABORTED` | The local waiter stopped. This does not revoke approval or undo a dispatched effect. |
147
+
148
+ Restart can resume a held review. It cannot infer that a request was not sent
149
+ from a timeout, missing response, crashed process, or lost completion report.
150
+ Only an exact server record that is still pending can repair an uncertain
151
+ initial creation into a held state. Redemption/dispatch fences are not reset.
152
+ A successful GET showing approval is not a grant to send: a fresh signed POST
153
+ must validate and redeem the original request.
154
+
155
+ There is no distributed transaction with an arbitrary SaaS. The journal commits
156
+ the dispatch fence before invoking the callback. This prevents automatic local
157
+ resend but can leave a request uncertain if the process dies between those two
158
+ steps. Third-party resource reconciliation and business idempotency remain
159
+ application responsibilities. A new machine must retain the same journal and
160
+ scope; deleting or restoring an old journal is not supported recovery.
161
+
162
+ ## Results And Storage
163
+
164
+ Successful native output is returned unchanged and is **not persisted**. A later
165
+ duplicate cannot reconstruct it. The journal stores bounded IDs, commitments,
166
+ states and an optional result digest. Opaque/non-JSON native returns can have a
167
+ null digest; neither a return nor a digest is independent resource verification.
168
+ MCP `isError: true` is returned unchanged but leaves the operation uncertain,
169
+ since native errors can occur after partial effects. Exceptions are sanitized;
170
+ arbitrary error strings, credentials and full outputs are not stored.
171
+
172
+ Outcome reporting is separate. If Studio loses the reporting acknowledgement,
173
+ the native result remains the return value and `reportState` is `uncertain`.
174
+ Do not replay the tool to repair a report. `close()` prevents new work; an
175
+ already-started native call is allowed to record its outcome before SQLite closes.
176
+
177
+ Use an owner-only directory and a durable local filesystem. Unsafe ownership,
178
+ permissions, symlinks/hardlinks and invalid database paths are rejected. SQLite
179
+ uses transactional CAS and full durability. The default limit is 10,000 retained
180
+ operations; exhaustion stops new work. Normal opening never creates a missing
181
+ database. Explicit initialization is a provisioning action, not recovery.
182
+ Do not delete completed or unknown rows
183
+ to make room: they are replay tombstones. Plan scoped lifecycle/retention with
184
+ the operator, retain the WAL correctly, and never share this database over an
185
+ unqualified network filesystem. Windows ACL qualification is not included.
186
+
187
+ ## Honest Coverage And Cost
188
+
189
+ Status reports `coverage: wrapped-call-only` and
190
+ `admissionPath: studio-current-action`. The raw client, alternative credentials,
191
+ direct resource access and a compromised application can bypass this wrapper.
192
+ It is not a resource-side enforcement boundary or a ZeroGate Action Pass path.
193
+ There is no claim that old Azure gate latency applies here. Current posture,
194
+ guard/action requests, durable writes and reporting all have real costs.
195
+ Studio responses are bounded to 1 MiB; larger responses refuse admission rather
196
+ than silently dropping evidence. Short configuration-cache contention can cause
197
+ bounded fresh configuration reads (at most six), never a repeated action POST
198
+ or tool invocation. A persistent cache lock is not removed automatically.
199
+
200
+ Production gateway deployment requires separate resource IAM, credentials,
201
+ network fencing, availability and recovery qualification. This release does not
202
+ enable Hook, modify the existing ZeroGate/Matoi algorithms or deploy that gateway.
package/README.md CHANGED
@@ -1,9 +1,13 @@
1
- # OSuite SDK (v2.10.1)
1
+ # OSuite SDK (v2.11.0)
2
2
 
3
3
  **Governed action SDK for AI agents.**
4
4
 
5
5
  The OSuite SDK helps teams route approvals, record governed decisions, and produce replayable evidence for AI agent activity.
6
6
 
7
+ The opt-in Node 24 `osuite/governed-tools` entry preserves native tool calls
8
+ and adds durable approval recovery. See [Native Tool Compatibility](GOVERNED_TOOLS.md).
9
+ It is not in the published 2.10.2 package and does not enable Hook or a gateway.
10
+
7
11
  ## Installation
8
12
 
9
13
  ### Node.js
@@ -13,7 +17,7 @@ npm install osuite
13
17
 
14
18
  ### Connect And Verify
15
19
 
16
- For the checked-out 2.10.1 source, run from the project you want to connect:
20
+ For a checked-out SDK source tree, run from the project you want to connect:
17
21
 
18
22
  ```bash
19
23
  node /absolute/path/to/osuite-sdk/sdk/cli.js connect
@@ -21,10 +25,11 @@ node /absolute/path/to/osuite-sdk/sdk/cli.js doctor
21
25
  node /absolute/path/to/osuite-sdk/sdk/cli.js try
22
26
  ```
23
27
 
24
- After the owner publishes 2.10.1 to npm, the equivalent pinned command is
25
- `npx osuite@2.10.1 connect`. A source release does not mean that npm's `latest`
26
- already contains it. Check `npm view osuite version` before relying on the new
27
- credential-recovery or Node-hook behavior.
28
+ For this version, use `npx osuite@2.11.0 connect` after confirming availability
29
+ with `npm view osuite@2.11.0 version`. A source checkout or this document alone
30
+ does not establish registry publication, and npm's `latest` may differ from the
31
+ checked-out version. The stable credential-recovery behavior and the new
32
+ native-call operation journal are different mechanisms.
28
33
 
29
34
  The alternative installer follows npm's published `latest`:
30
35
 
@@ -60,7 +65,9 @@ Slack and email notifications require configured workspace channels.
60
65
 
61
66
  ## The Governance Loop
62
67
 
63
- The SDK transports requests; it does not execute your tool. A guard evaluation or
68
+ The default SDK transports requests; it does not execute your tool. The opt-in
69
+ native-tool wrapper invokes only the callback explicitly supplied to it.
70
+ A guard evaluation or
64
71
  `waitForApproval()` result is not execution authorization on its own. A secure
65
72
  integration must preserve all four steps:
66
73
 
@@ -518,6 +525,49 @@ For local CLI agents, `osuite connect auto` opens the browser handoff in your br
518
525
 
519
526
  Project installation refuses settings or hook paths whose symlinks resolve outside the project's real root, including linked parent directories. Credential storage also refuses any symlink, hardlink or Git-tracked destination; successful POSIX writes use mode `0600` and exact ignore entries. A browser approval alone does not retire the previous runtime credential: the versioned connection protocol waits for durable local storage and acknowledgement. If interrupted, resume the same `osuite connect` command rather than deleting its recovery journal. Manual API keys and other runtime connections are not replaced. Existing settings are merged; `disableAllHooks: true` and explicit Codex hook-disable flags stay disabled even with `--force`. Disabled setup is reported as not ready, not as a successful connection.
520
527
 
528
+ Fresh project/runtime installations now keep two separate random identifiers in
529
+ an ignored, protected `.env.identity.json` beside the runtime's credential file:
530
+ an installation identifier and the default agent identifier. Neither identifies
531
+ a person or attests hardware. Different project/runtime installations on the same
532
+ computer remain different installations, not additional licensed developers.
533
+ Do not copy identity/credential files between devices. Existing configured agent
534
+ identifiers and interrupted connection journals are preserved.
535
+
536
+ Replacing an existing connection requires its current credential, including when
537
+ only one legacy connection has that name. An omitted, incorrect or revoked key
538
+ cannot implicitly reclaim the identity. If a device/credential is lost, an
539
+ authorized administrator retires that connection and approves a new unique
540
+ identity; use an explicit new `--agent-id` if retaining the old project directory.
541
+ Preserve historical records and signing keys instead of reassigning past actions
542
+ to the replacement. A client-side installation ID is not permission to rotate.
543
+
544
+ ### SDK and MCP Credential Separation (Since 2.10.2)
545
+
546
+ SDK connections use `.osuite/.env`; MCP connections use `.osuite/mcp/.env`.
547
+ Their installation metadata and recovery journals live beside their respective
548
+ credential files. Connecting one runtime does not borrow another runtime's key
549
+ from a merged project configuration. If an interrupted journal conflicts with
550
+ the current credential bundle, the CLI stops before storage or acknowledgement;
551
+ inspect the current connection instead of deleting the journal to force a retry.
552
+
553
+ For an older MCP installation stored at the SDK path, stop that local MCP client
554
+ and run this explicit, local-only migration from its project directory:
555
+
556
+ ```sh
557
+ osuite connect mcp --migrate-legacy
558
+ ```
559
+
560
+ This moves the verified MCP bundle, including any identity and recovery state,
561
+ without issuing a key, contacting Studio, or acknowledging an enrollment. It
562
+ refuses ambiguous runtime ownership or an occupied destination. An interrupted
563
+ move leaves a durable marker; inspect the files and rerun the same migration,
564
+ rather than deleting its marker or copying credentials. Update the MCP launcher's
565
+ credential-file reference to `.osuite/mcp/.env` before restarting it or creating an
566
+ SDK connection. The command does not rewrite vendor launchers or enable hooks.
567
+
568
+ Use version 2.10.2 or newer for this credential migration. It does not install or
569
+ activate the separate native-tool execution wrapper.
570
+
521
571
  `doctor` separates hook configuration, project enablement, credentials, connectivity, telemetry, and an enforced policy outcome. Observation-only mode, an unavailable guard (whether fail-open or fail-closed), or telemetry without a matching policy outcome does not pass the governance check. Hook warnings are printed even when the probe otherwise succeeds. The probe never executes its sample tool command and does not prove the host loaded the hooks: start or restart the runtime and verify its actual hook invocation separately.
522
572
 
523
573
  Onboarding diagnostics are opt-in: `OSUITE_ONBOARDING_METRICS=1 osuite doctor` reports only the first diagnostic pass/fail result and, when supplied by the installer, its start timestamp. It sends no command text, filesystem paths or diagnostic log. Reconnection or a later passing check does not erase the first failure. Without the opt-in, no diagnostic measurement is sent. Reporting failure never changes the doctor result. Aggregate dashboards distinguish reported samples from all connected agents.