@ixo/oracle-runtime-workers 0.38.0 → 0.40.1
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 +5 -4
- package/src/action-interactions/routes.ts +78 -0
- package/src/action-interactions/store.ts +1038 -0
- package/src/channels/replies.ts +8 -4
- package/src/core/capability-expiry.ts +62 -0
- package/src/core/capability-router.ts +126 -95
- package/src/core/context-budget.ts +116 -4
- package/src/core/domain-context/document.ts +74 -2
- package/src/core/domain-context/index.ts +1 -0
- package/src/core/domain-context/resolver.ts +9 -6
- package/src/core/domain-context/turn-context.ts +62 -13
- package/src/core/domain-context/types.ts +17 -0
- package/src/core/env.ts +21 -2
- package/src/core/index.ts +4 -0
- package/src/core/llm.ts +29 -0
- package/src/core/main-agent-types.ts +45 -4
- package/src/core/main-agent.ts +210 -122
- package/src/core/manifest.ts +109 -24
- package/src/core/mcp-result.ts +56 -0
- package/src/core/meta-tools.ts +258 -110
- package/src/core/middlewares/capability-gate.ts +77 -28
- package/src/core/middlewares/context-guard.ts +154 -21
- package/src/core/middlewares/result-cap.ts +1 -1
- package/src/core/middlewares/summarization.ts +9 -0
- package/src/core/middlewares/tool-marks.ts +11 -2
- package/src/core/middlewares/tool-repetition-guard.ts +61 -1
- package/src/core/middlewares/turn-boundary.ts +22 -12
- package/src/core/operating-guides.ts +126 -0
- package/src/core/plugins/skills/skills-tools.ts +6 -31
- package/src/core/plugins/skills/skills.plugin.ts +4 -3
- package/src/core/plugins/weather/weather.plugin.ts +1 -0
- package/src/core/prompt-composer.ts +188 -111
- package/src/core/read-result-tool.ts +48 -14
- package/src/core/registries.ts +13 -5
- package/src/core/state.ts +4 -3
- package/src/core/sub-agent-fallback.ts +1 -0
- package/src/core/subagent-as-tool.ts +4 -1
- package/src/core/tool-access.ts +3 -32
- package/src/core/wrap-plugin-tool.ts +2 -1
- package/src/do/contracts.ts +45 -1
- package/src/do/transcript.ts +40 -11
- package/src/do/turn-metadata.ts +16 -4
- package/src/do/user-oracle-do.ts +358 -62
- package/src/index.ts +1 -0
- package/src/memory/session-history-indexer.ts +60 -14
- package/src/plugin-api/oracle-plugin.ts +4 -5
- package/src/plugin-api/types.ts +32 -3
- package/src/plugins/action-proposals/action-proposals.plugin.ts +7 -2
- package/src/plugins/agui/agui.plugin.ts +1 -0
- package/src/plugins/compact-schema.ts +80 -0
- package/src/plugins/composio/composio.plugin.ts +1 -0
- package/src/plugins/domain-indexer/domain-indexer.plugin.ts +4 -3
- package/src/plugins/editor/editor.plugin.ts +4 -0
- package/src/plugins/firecrawl/firecrawl-agent.ts +2 -0
- package/src/plugins/firecrawl/firecrawl.plugin.ts +1 -0
- package/src/plugins/flows/flows.plugin.ts +37 -6
- package/src/plugins/flows/prompts.ts +1 -1
- package/src/plugins/flows/tools/authoring.ts +5 -7
- package/src/plugins/flows/tools/discovery.ts +1 -4
- package/src/plugins/flows/tools/forms.ts +2 -8
- package/src/plugins/flows/tools/linkage.ts +1 -4
- package/src/plugins/flows/tools/settings.ts +1 -4
- package/src/plugins/flows/translator.ts +16 -5
- package/src/plugins/flows/types.ts +27 -48
- package/src/plugins/hub-actions/hub-actions.plugin.ts +30 -4
- package/src/plugins/index.ts +2 -2
- package/src/plugins/ixo-chain/ixo-chain.plugin.ts +29 -5
- package/src/plugins/ixo-chain/kinds/core.ts +2 -2
- package/src/plugins/ixo-chain/kinds/types.ts +34 -5
- package/src/plugins/ixo-chain/queries.ts +10 -1
- package/src/plugins/ixo-transaction/ixo-transaction.plugin.ts +1 -0
- package/src/plugins/matrix-group-chats/index.ts +1 -0
- package/src/plugins/memory/memory-tools.ts +4 -4
- package/src/plugins/memory/memory.plugin.ts +27 -1
- package/src/plugins/memory/oracle-document-tools.ts +24 -49
- package/src/plugins/pod-creator/pod-creator.plugin.ts +1 -0
- package/src/plugins/portal/portal.plugin.ts +3 -1
- package/src/plugins/sandbox/sandbox-write-blob.ts +3 -15
- package/src/plugins/sandbox/sandbox.plugin.ts +19 -2
- package/src/plugins/tasks/manifest.ts +1 -0
- package/src/plugins/tasks/tasks-tools.ts +34 -39
- package/src/plugins/user-preferences/user-preferences-tool.ts +11 -37
- package/src/plugins/user-preferences/user-preferences.plugin.ts +4 -0
- package/src/plugins/vfs/vfs-tools.ts +6 -6
- package/src/plugins/vfs/vfs.plugin.ts +4 -5
- package/src/plugins/yoma/yoma.plugin.ts +1 -0
- package/src/shell/app.ts +241 -6
- package/src/sqlite/serialization.ts +12 -0
- package/src/sqlite/sqlite-saver.ts +17 -0
- package/src/tasks/schedule-input.ts +5 -22
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ixo/oracle-runtime-workers",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.40.1",
|
|
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": {
|
|
@@ -67,9 +67,10 @@
|
|
|
67
67
|
"protobufjs": "^7.6.5",
|
|
68
68
|
"@ixo/topic-protocol": "1.0.0-rc.8",
|
|
69
69
|
"survey-core": "2.3.11",
|
|
70
|
-
"@ixo/
|
|
71
|
-
"@ixo/
|
|
72
|
-
"@ixo/
|
|
70
|
+
"@ixo/common": "1.8.0",
|
|
71
|
+
"@ixo/ixo-transaction": "0.2.0",
|
|
72
|
+
"@ixo/action-interactions": "0.1.1",
|
|
73
|
+
"@ixo/ucan": "2.3.0"
|
|
73
74
|
},
|
|
74
75
|
"devDependencies": {
|
|
75
76
|
"@cloudflare/vitest-pool-workers": "^0.22.0",
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ActionInteractionError,
|
|
3
|
+
PrepareInteractionSchema,
|
|
4
|
+
UpdateInteractionSchema,
|
|
5
|
+
ReserveInteractionSchema,
|
|
6
|
+
ObserveInteractionSchema,
|
|
7
|
+
} from '@ixo/action-interactions';
|
|
8
|
+
import { z } from 'zod';
|
|
9
|
+
import type { InteractionCommand } from './store';
|
|
10
|
+
|
|
11
|
+
const InteractionIdSchema = z.string().uuid();
|
|
12
|
+
const InteractionSessionIdSchema = z.string().min(1).max(512);
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Structural parsing happens before the authenticated per-user object is
|
|
16
|
+
* called. Only these shapes exist: `POST /` prepares, `PATCH /:id` updates
|
|
17
|
+
* or cancels, `POST /:id/reserve` and `POST /:id/observe` are the host's.
|
|
18
|
+
* Anything else, including a path id that is not a UUID, is not found.
|
|
19
|
+
*/
|
|
20
|
+
export async function parseInteractionCommand(
|
|
21
|
+
request: Request,
|
|
22
|
+
id?: string,
|
|
23
|
+
hostOperation?: string,
|
|
24
|
+
): Promise<InteractionCommand> {
|
|
25
|
+
const notFound = () =>
|
|
26
|
+
new ActionInteractionError(
|
|
27
|
+
404,
|
|
28
|
+
'not_found',
|
|
29
|
+
'Unknown interaction operation',
|
|
30
|
+
);
|
|
31
|
+
if (id !== undefined && !InteractionIdSchema.safeParse(id).success)
|
|
32
|
+
throw notFound();
|
|
33
|
+
const method = request.method;
|
|
34
|
+
const body: unknown = await request.json().catch(() => null);
|
|
35
|
+
if (method === 'POST' && id === undefined && hostOperation === undefined)
|
|
36
|
+
return { kind: 'prepare', input: PrepareInteractionSchema.parse(body) };
|
|
37
|
+
if (method === 'PATCH' && id !== undefined && hostOperation === undefined)
|
|
38
|
+
return { kind: 'update', id, input: UpdateInteractionSchema.parse(body) };
|
|
39
|
+
if (method === 'POST' && id !== undefined && hostOperation === 'reserve')
|
|
40
|
+
return { kind: 'reserve', id, input: ReserveInteractionSchema.parse(body) };
|
|
41
|
+
if (method === 'POST' && id !== undefined && hostOperation === 'observe')
|
|
42
|
+
return { kind: 'observe', id, input: ObserveInteractionSchema.parse(body) };
|
|
43
|
+
throw notFound();
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/** A read: `GET /?sessionId=` lists, `GET /:id?sessionId=` reads one. */
|
|
47
|
+
export function parseInteractionRead(
|
|
48
|
+
sessionId: string | undefined,
|
|
49
|
+
id?: string,
|
|
50
|
+
operation?: string,
|
|
51
|
+
): { sessionId: string; id?: string } {
|
|
52
|
+
if (
|
|
53
|
+
operation !== undefined ||
|
|
54
|
+
(id !== undefined && !InteractionIdSchema.safeParse(id).success)
|
|
55
|
+
)
|
|
56
|
+
throw new ActionInteractionError(404, 'not_found', 'Interaction not found');
|
|
57
|
+
const session = InteractionSessionIdSchema.safeParse(sessionId);
|
|
58
|
+
if (!session.success)
|
|
59
|
+
throw new ActionInteractionError(
|
|
60
|
+
400,
|
|
61
|
+
'invalid_request',
|
|
62
|
+
'sessionId is required',
|
|
63
|
+
);
|
|
64
|
+
return { sessionId: session.data, ...(id !== undefined ? { id } : {}) };
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/** The HTTP status for an owner refusal; anything unexpected is a conflict. */
|
|
68
|
+
export function interactionStatus(
|
|
69
|
+
status: number,
|
|
70
|
+
): 400 | 403 | 404 | 409 | 410 | 413 {
|
|
71
|
+
return status === 400 ||
|
|
72
|
+
status === 403 ||
|
|
73
|
+
status === 404 ||
|
|
74
|
+
status === 410 ||
|
|
75
|
+
status === 413
|
|
76
|
+
? status
|
|
77
|
+
: 409;
|
|
78
|
+
}
|