@ixo/oracle-runtime-workers 0.21.0 → 0.21.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ixo/oracle-runtime-workers",
|
|
3
|
-
"version": "0.21.
|
|
3
|
+
"version": "0.21.2",
|
|
4
4
|
"description": "QiForge oracle runtime for Cloudflare Workers — Durable Object per user (SQLite in WASM over DO storage), Matrix E2EE gateway Durable Object, Hono HTTP/SSE shell.",
|
|
5
5
|
"private": false,
|
|
6
6
|
"publishConfig": {
|
|
@@ -59,8 +59,8 @@
|
|
|
59
59
|
"yjs": "13.6.32",
|
|
60
60
|
"zod": "^4.4.3",
|
|
61
61
|
"@ixo/ucan": "2.2.1",
|
|
62
|
-
"@ixo/
|
|
63
|
-
"@ixo/
|
|
62
|
+
"@ixo/common": "1.7.0",
|
|
63
|
+
"@ixo/ixo-transaction": "0.1.0"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
66
66
|
"@cloudflare/vitest-pool-workers": "^0.22.0",
|
package/src/do/user-oracle-do.ts
CHANGED
|
@@ -3198,17 +3198,28 @@ export function createUserOracleDO(opts: UserOracleDOOptions) {
|
|
|
3198
3198
|
client: TurnRequest['client'];
|
|
3199
3199
|
roomKind: TurnRequest['roomKind'];
|
|
3200
3200
|
}): UserContextSettle | null {
|
|
3201
|
-
//
|
|
3202
|
-
|
|
3201
|
+
// A first contact that fetches nothing still prints the one
|
|
3202
|
+
// first-contact line (see the settle step below), with its reason, so
|
|
3203
|
+
// a warn-level reading of the logs accounts for every first turn.
|
|
3204
|
+
const skipped = (reason: string): null => {
|
|
3205
|
+
if (!hasUserContext(input.prior)) {
|
|
3206
|
+
console.warn(
|
|
3207
|
+
`[user-context] first contact room=${input.roomId ?? '-'} session=${input.sessionId} outcome=skipped reason=${reason} waited=0ms`,
|
|
3208
|
+
);
|
|
3209
|
+
}
|
|
3203
3210
|
return null;
|
|
3211
|
+
};
|
|
3212
|
+
// Task runs never get the user's memory (see `scheduleHistoryIndexing`).
|
|
3213
|
+
if (input.sessionId.startsWith(TASK_SESSION_PREFIX)) return null;
|
|
3214
|
+
if (!input.roomId) return skipped('no-room');
|
|
3204
3215
|
const settings = this.userContextSettings();
|
|
3216
|
+
if (!settings) return skipped('disabled');
|
|
3205
3217
|
const ambient = this.ambient;
|
|
3206
|
-
if (!
|
|
3218
|
+
if (!ambient) return skipped('not-booted');
|
|
3207
3219
|
// A group room's reply is posted to every member: one user's memory
|
|
3208
3220
|
// must not be (as direct reads are not, see `admissionApplies`).
|
|
3209
3221
|
if (input.client === 'matrix' && input.roomKind === 'group') {
|
|
3210
|
-
|
|
3211
|
-
return null;
|
|
3222
|
+
return skipped('group-room');
|
|
3212
3223
|
}
|
|
3213
3224
|
// Without a memory grant the gather could only fail at the mint: skip
|
|
3214
3225
|
// it before any request (the engine's did.json included).
|
|
@@ -3219,10 +3230,7 @@ export function createUserOracleDO(opts: UserOracleDOOptions) {
|
|
|
3219
3230
|
MEMORY_CAPABILITY.action,
|
|
3220
3231
|
)
|
|
3221
3232
|
) {
|
|
3222
|
-
|
|
3223
|
-
`[user-context] skipped: the delegation grants no ${MEMORY_CAPABILITY.resource} ${MEMORY_CAPABILITY.action}`,
|
|
3224
|
-
);
|
|
3225
|
-
return null;
|
|
3233
|
+
return skipped('no-memory-grant');
|
|
3226
3234
|
}
|
|
3227
3235
|
const fetcher = this.userContextFetcherFor(settings);
|
|
3228
3236
|
const params: UserContextFetchParams = {
|
|
@@ -3265,8 +3273,12 @@ export function createUserOracleDO(opts: UserOracleDOOptions) {
|
|
|
3265
3273
|
// One line per first contact, at warn so it stands out when logs
|
|
3266
3274
|
// are read at warn and above: what the turn was given and how
|
|
3267
3275
|
// long it waited for it.
|
|
3276
|
+
const reason =
|
|
3277
|
+
outcome?.kind === 'skipped' || outcome?.kind === 'failed'
|
|
3278
|
+
? ` reason=${outcome.reason}`
|
|
3279
|
+
: '';
|
|
3268
3280
|
console.warn(
|
|
3269
|
-
`[user-context] first contact room=${input.roomId} session=${input.sessionId} outcome=${outcome?.kind ?? 'aborted'} waited=${Date.now() - waitedFrom}ms`,
|
|
3281
|
+
`[user-context] first contact room=${input.roomId} session=${input.sessionId} outcome=${outcome?.kind ?? 'aborted'}${reason} waited=${Date.now() - waitedFrom}ms`,
|
|
3270
3282
|
);
|
|
3271
3283
|
return outcome?.kind === 'cached' || outcome?.kind === 'fresh'
|
|
3272
3284
|
? withEverySlot(outcome.context)
|
|
@@ -54,6 +54,13 @@ const manifest: PluginManifest = {
|
|
|
54
54
|
|
|
55
55
|
export const BROWSER_TOOL_TIMEOUT_MS = 15_000;
|
|
56
56
|
|
|
57
|
+
const HUMAN_DECISION_TOOLS = new Set([
|
|
58
|
+
'ask_user_question',
|
|
59
|
+
'propose_domain_creation',
|
|
60
|
+
'write_domain_files',
|
|
61
|
+
'publish_recipe_release',
|
|
62
|
+
]);
|
|
63
|
+
|
|
57
64
|
/**
|
|
58
65
|
* The Portal's Topic write tool. Its commands can take a while to settle in
|
|
59
66
|
* the browser (several Matrix writes), so it gets a longer window before the
|
|
@@ -194,7 +201,10 @@ export function buildBrowserTool(
|
|
|
194
201
|
description: descriptor.description,
|
|
195
202
|
schema,
|
|
196
203
|
// A browser step (scroll, page, click) repeated is a new step.
|
|
197
|
-
repeatable:
|
|
204
|
+
repeatable: !HUMAN_DECISION_TOOLS.has(descriptor.name),
|
|
205
|
+
...(HUMAN_DECISION_TOOLS.has(descriptor.name)
|
|
206
|
+
? { effect: 'write' as const }
|
|
207
|
+
: {}),
|
|
198
208
|
},
|
|
199
209
|
);
|
|
200
210
|
}
|