osuite 2.11.1 → 2.11.2
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/GOVERNED_TOOLS.md +8 -1
- package/README.md +15 -3
- package/governed-tools/authority.mjs +1 -0
- package/governed-tools/executor.mjs +6 -0
- package/governed-tools/journal.mjs +1 -1
- package/package.json +1 -1
- package/runtime/state.mjs +26 -14
package/GOVERNED_TOOLS.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Native Tool Compatibility And Recovery
|
|
2
2
|
|
|
3
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.
|
|
4
|
+
chosen version with `npm view osuite@2.11.2 version` before installing. A source
|
|
5
5
|
checkout alone does not establish npm availability or server compatibility;
|
|
6
6
|
consult the verified release record before enabling it for a workspace.
|
|
7
7
|
|
|
@@ -142,6 +142,7 @@ creates a different scope: never use that as a recovery shortcut.
|
|
|
142
142
|
| `OUTCOME_UNKNOWN` | Inspect the resource separately; do not automatically resend. |
|
|
143
143
|
| `POLICY_DENIED` / expiry / cancellation | Respect the terminal refusal. A new intention needs explicit operator action. |
|
|
144
144
|
| `CURRENT_AUTHORITY_UNAVAILABLE` | Restore current server/identity configuration; never fall back to ungoverned execution. |
|
|
145
|
+
| `JOURNAL_BUSY` | Preserve the same ID and journal; inspect contention and existing status. No automatic resend or state reset. |
|
|
145
146
|
| `JOURNAL_MISSING` / invalid journal | Restore the correct durable journal; do not initialize an empty replacement to replay old IDs. |
|
|
146
147
|
| `ABORTED` | The local waiter stopped. This does not revoke approval or undo a dispatched effect. |
|
|
147
148
|
|
|
@@ -187,6 +188,12 @@ permissions, symlinks/hardlinks and invalid database paths are rejected. SQLite
|
|
|
187
188
|
uses transactional CAS and full durability. The default limit is 10,000 retained
|
|
188
189
|
operations; exhaustion stops new work. Normal opening never creates a missing
|
|
189
190
|
database. Explicit initialization is a provisioning action, not recovery.
|
|
191
|
+
Version 2.11.2 changes the default `journalOptions.busyTimeoutMs`
|
|
192
|
+
from 100 to 1,000 ms; the supported range remains 0-5,000 ms. This is a bounded
|
|
193
|
+
local write-lock budget, not extra approval time or an operation retry policy.
|
|
194
|
+
After the dispatch fence commits, the existing five-second admission-receipt
|
|
195
|
+
age limit is checked again immediately before the callback. An expired receipt
|
|
196
|
+
leaves an uncertain fence; it is never renewed or automatically retried.
|
|
190
197
|
Do not delete completed or unknown rows
|
|
191
198
|
to make room: they are replay tombstones. Plan scoped lifecycle/retention with
|
|
192
199
|
the operator, retain the WAL correctly, and never share this database over an
|
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# OSuite SDK (v2.11.
|
|
1
|
+
# OSuite SDK (v2.11.2)
|
|
2
2
|
|
|
3
3
|
**Governed action SDK for AI agents.**
|
|
4
4
|
|
|
@@ -25,8 +25,8 @@ node /absolute/path/to/osuite-sdk/sdk/cli.js doctor
|
|
|
25
25
|
node /absolute/path/to/osuite-sdk/sdk/cli.js try
|
|
26
26
|
```
|
|
27
27
|
|
|
28
|
-
For this version, use `npx osuite@2.11.
|
|
29
|
-
with `npm view osuite@2.11.
|
|
28
|
+
For this version, use `npx osuite@2.11.2 connect` only after confirming availability
|
|
29
|
+
with `npm view osuite@2.11.2 version`. A source checkout or this document alone
|
|
30
30
|
does not establish registry publication, and npm's `latest` may differ from the
|
|
31
31
|
checked-out version. The stable credential-recovery behavior and the new
|
|
32
32
|
native-call operation journal are different mechanisms.
|
|
@@ -97,6 +97,18 @@ by Claude Code 2.1.295 and later and tested on 2.1.300. Existing custom or disab
|
|
|
97
97
|
registrations are preserved; `doctor` warns when the failure policy is absent.
|
|
98
98
|
That setting is not a guarantee for older Claude versions or other hosts.
|
|
99
99
|
|
|
100
|
+
## Concurrent Recovery In 2.11.2
|
|
101
|
+
|
|
102
|
+
Version 2.11.2 rechecks bounded atomic state-file replacements without trusting
|
|
103
|
+
detached data or relaxing symlink/hardlink checks. The opt-in native journal
|
|
104
|
+
waits up to 1,000 ms for a write lock by default, with no transaction or action
|
|
105
|
+
replay. A pre-send exhausted lock remains `JOURNAL_BUSY`; it is not permission
|
|
106
|
+
to change the business ID or clear state. Admission age is checked again after
|
|
107
|
+
the durable dispatch fence, so local I/O cannot silently extend its validity.
|
|
108
|
+
These source corrections are not present in immutable `2.11.1`. Verify a
|
|
109
|
+
published version and its provenance before deploying it; no new Hook is enabled
|
|
110
|
+
by this source update.
|
|
111
|
+
|
|
100
112
|
## The Governance Loop
|
|
101
113
|
|
|
102
114
|
The default SDK transports requests; it does not execute your tool. The opt-in
|
|
@@ -112,6 +112,7 @@ export function createStudioAuthority(config, journalPath) {
|
|
|
112
112
|
reject(claimed ? 'OUTCOME_UNKNOWN' : 'CURRENT_AUTHORITY_UNAVAILABLE');
|
|
113
113
|
} catch (error) {
|
|
114
114
|
if (claimed) settle(phase === 'redeeming' ? 'uncertain_redemption' : 'uncertain_request');
|
|
115
|
+
if (!claimed && error?.name === 'OperationJournalError' && error.code === 'JOURNAL_BUSY') reject('JOURNAL_BUSY');
|
|
115
116
|
throw error;
|
|
116
117
|
}
|
|
117
118
|
}
|
|
@@ -140,6 +140,12 @@ export function createGovernedTools({ config: rawConfig, namespace, journalPath,
|
|
|
140
140
|
reject(aborted() ? 'ABORTED' : 'OUTCOME_UNKNOWN', status(local(operationId)));
|
|
141
141
|
}
|
|
142
142
|
if (!journal.settle(scope, operationId, owner, admitted.phase, 'dispatching')) reject('OPERATION_BUSY', status(local(operationId)));
|
|
143
|
+
// Durable local I/O can outlive the admission, even without an await.
|
|
144
|
+
if (aborted() || closed || performance.now() - admitted.receivedAt > 5000) {
|
|
145
|
+
try { journal.settle(scope, operationId, owner, 'dispatching', 'uncertain'); }
|
|
146
|
+
catch { /* The committed dispatch fence still forbids replay if cleanup cannot write. */ }
|
|
147
|
+
reject(aborted() ? 'ABORTED' : 'OUTCOME_UNKNOWN', status(local(operationId)));
|
|
148
|
+
}
|
|
143
149
|
let result, resultDigest = null, state = 'completed', thrown = false;
|
|
144
150
|
try { result = await execute(invocation.params); }
|
|
145
151
|
catch { thrown = true; state = 'uncertain'; }
|
|
@@ -198,7 +198,7 @@ export class OperationJournal {
|
|
|
198
198
|
const config = dataObject(options, ['maxOperations', 'busyTimeoutMs', 'create'], 'JOURNAL_CONFIG');
|
|
199
199
|
const create = config.create === undefined ? true : config.create;
|
|
200
200
|
this.#maxOperations = config.maxOperations === undefined ? 10000 : config.maxOperations;
|
|
201
|
-
this.#busyTimeoutMs = config.busyTimeoutMs === undefined ?
|
|
201
|
+
this.#busyTimeoutMs = config.busyTimeoutMs === undefined ? 1000 : config.busyTimeoutMs;
|
|
202
202
|
if (typeof create !== 'boolean' || !Number.isSafeInteger(this.#maxOperations) || this.#maxOperations < 1
|
|
203
203
|
|| !Number.isSafeInteger(this.#busyTimeoutMs) || this.#busyTimeoutMs < 0 || this.#busyTimeoutMs > 5000) fail('JOURNAL_CONFIG');
|
|
204
204
|
if (typeof path !== 'string' || !isAbsolute(path) || path.length > 4096 || path.includes('\0')
|
package/package.json
CHANGED
package/runtime/state.mjs
CHANGED
|
@@ -5,16 +5,23 @@ import { randomUUID } from 'node:crypto';
|
|
|
5
5
|
import { canonicalJson, sha256 } from './protocol.mjs';
|
|
6
6
|
|
|
7
7
|
const MAX_STATE_BYTES = 2 * 1024 * 1024;
|
|
8
|
+
const MAX_STATE_CHECKS = 3;
|
|
8
9
|
|
|
9
10
|
function checkedFile(filename) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
11
|
+
for (let attempt = 0; attempt < MAX_STATE_CHECKS; attempt++) {
|
|
12
|
+
try {
|
|
13
|
+
const stat = fs.lstatSync(filename);
|
|
14
|
+
if (!stat.isFile() || stat.isSymbolicLink()) throw new Error('Unsafe runtime state file');
|
|
15
|
+
// Atomic replacement can detach the inode during inspection; check the new path, never trust the old one.
|
|
16
|
+
if (stat.nlink === 0) continue;
|
|
17
|
+
if (stat.nlink !== 1) throw new Error('Unsafe runtime state file');
|
|
18
|
+
return stat;
|
|
19
|
+
} catch (error) {
|
|
20
|
+
if (error.code === 'ENOENT') return null;
|
|
21
|
+
throw error;
|
|
22
|
+
}
|
|
17
23
|
}
|
|
24
|
+
throw new Error('Runtime state changed during inspection');
|
|
18
25
|
}
|
|
19
26
|
|
|
20
27
|
export function createStateStore(config) {
|
|
@@ -34,13 +41,18 @@ export function createStateStore(config) {
|
|
|
34
41
|
path: filename,
|
|
35
42
|
read(name) {
|
|
36
43
|
const file = filename(name);
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
+
for (let attempt = 0; attempt < MAX_STATE_CHECKS; attempt++) {
|
|
45
|
+
if (!checkedFile(file)) return null;
|
|
46
|
+
const fd = fs.openSync(file, fs.constants.O_RDONLY | (fs.constants.O_NOFOLLOW || 0) | fs.constants.O_NONBLOCK);
|
|
47
|
+
try {
|
|
48
|
+
const stat = fs.fstatSync(fd);
|
|
49
|
+
if (!stat.isFile()) throw new Error('Invalid runtime state file');
|
|
50
|
+
if (stat.nlink === 0) continue;
|
|
51
|
+
if (stat.nlink !== 1 || stat.size > MAX_STATE_BYTES) throw new Error('Invalid runtime state file');
|
|
52
|
+
return JSON.parse(fs.readFileSync(fd, 'utf8'));
|
|
53
|
+
} finally { fs.closeSync(fd); }
|
|
54
|
+
}
|
|
55
|
+
throw new Error('Runtime state changed during read');
|
|
44
56
|
},
|
|
45
57
|
write(name, value) {
|
|
46
58
|
const file = filename(name);
|