@lunora/agent 1.0.0-alpha.3 → 1.0.0-alpha.5
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/dist/channels.d.mts +39 -31
- package/dist/channels.d.ts +39 -31
- package/dist/channels.mjs +1 -1
- package/dist/component.d.mts +57 -68
- package/dist/component.d.ts +57 -68
- package/dist/component.mjs +20 -9
- package/dist/inbound.d.mts +20 -20
- package/dist/inbound.d.ts +20 -20
- package/dist/index.d.mts +474 -490
- package/dist/index.d.ts +474 -490
- package/dist/index.mjs +4 -4
- package/dist/naming.d.mts +19 -19
- package/dist/naming.d.ts +19 -19
- package/dist/packem_shared/{agentAsTool-Dt8NlU6k.mjs → agentAsTool-CUHlWsmt.mjs} +5 -1
- package/dist/packem_shared/{compileAgentWorkflow-BxJjHgtD.mjs → compileAgentWorkflow-DX90058f.mjs} +1 -1
- package/dist/packem_shared/{defineAgent-D6maSbVc.mjs → defineAgent-DAwAZC9P.mjs} +1 -1
- package/dist/packem_shared/{graph-component-aoUwO-f0.mjs → graph-component-Bbaxxymp.mjs} +3 -2
- package/dist/packem_shared/{normalizeEntityName-CyEEWFkR.mjs → normalizeEntityName-BouctxLC.mjs} +1 -1
- package/dist/packem_shared/{runAgentLoop-Dhg4ZNvw.mjs → runAgentLoop-B3Q2o-Uz.mjs} +1 -1
- package/dist/packem_shared/types.d-boAM2Yi1.d.mts +1114 -0
- package/dist/packem_shared/types.d-boAM2Yi1.d.ts +1114 -0
- package/dist/sandbox.d.mts +126 -122
- package/dist/sandbox.d.ts +126 -122
- package/dist/sandbox.mjs +5 -1
- package/dist/telemetry/index.d.mts +103 -103
- package/dist/telemetry/index.d.ts +103 -103
- package/package.json +8 -8
- package/dist/packem_shared/types.d-BhJFTvz_.d.mts +0 -1114
- package/dist/packem_shared/types.d-BhJFTvz_.d.ts +0 -1114
package/dist/index.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export { runAgentLoop, splitForCompaction } from './packem_shared/runAgentLoop-
|
|
1
|
+
export { runAgentLoop, splitForCompaction } from './packem_shared/runAgentLoop-B3Q2o-Uz.mjs';
|
|
2
2
|
export { collectAgenticMemoryTools, toSearchResults } from './packem_shared/collectAgenticMemoryTools-QrzpV-WX.mjs';
|
|
3
|
-
export { agentAsTool } from './packem_shared/agentAsTool-
|
|
3
|
+
export { agentAsTool } from './packem_shared/agentAsTool-CUHlWsmt.mjs';
|
|
4
4
|
export { codeTool } from './packem_shared/codeTool-CjgJOC9t.mjs';
|
|
5
5
|
export { agentComponent, agentExtension } from './component.mjs';
|
|
6
6
|
export { default as createAgentContext } from './packem_shared/createAgentContext-4xJGXNR4.mjs';
|
|
7
|
-
export { defineAgent, defineAgentTool, isAgentDefinition } from './packem_shared/defineAgent-
|
|
7
|
+
export { defineAgent, defineAgentTool, isAgentDefinition } from './packem_shared/defineAgent-DAwAZC9P.mjs';
|
|
8
8
|
export { functionTool } from './packem_shared/functionTool-D6lCa2jB.mjs';
|
|
9
9
|
export { createAgentGenerate, createEpisodeExtract, createGraphExtract, createStreamGenerate, resolveAgentModel } from './packem_shared/createAgentGenerate-BQv9YJ01.mjs';
|
|
10
10
|
export { adaptMcpResult, mcpTools } from './packem_shared/adaptMcpResult-wtNMvLoP.mjs';
|
|
@@ -15,4 +15,4 @@ export { browserTool, containerTool, fsTool } from './sandbox.mjs';
|
|
|
15
15
|
export { defineSkill, isSkillDefinition } from './packem_shared/defineSkill-Ctf_S-rz.mjs';
|
|
16
16
|
export { default as VoiceSessionDO } from './packem_shared/VoiceSessionDO-DLoXsHGF.mjs';
|
|
17
17
|
export { runVoiceTurn } from './packem_shared/runVoiceTurn-LnqLvCRR.mjs';
|
|
18
|
-
export { default as compileAgentWorkflow } from './packem_shared/compileAgentWorkflow-
|
|
18
|
+
export { default as compileAgentWorkflow } from './packem_shared/compileAgentWorkflow-DX90058f.mjs';
|
package/dist/naming.d.mts
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `support` → `SupportAgentWorkflow` — the generated WorkflowEntrypoint class name.
|
|
3
|
-
* @experimental
|
|
4
|
-
*/
|
|
2
|
+
* `support` → `SupportAgentWorkflow` — the generated WorkflowEntrypoint class name.
|
|
3
|
+
* @experimental
|
|
4
|
+
*/
|
|
5
5
|
declare const agentClassName: (exportName: string) => string;
|
|
6
6
|
/**
|
|
7
|
-
* `support` → `AGENT_SUPPORT` — the Cloudflare Workflows binding name.
|
|
8
|
-
* @experimental
|
|
9
|
-
*/
|
|
7
|
+
* `support` → `AGENT_SUPPORT` — the Cloudflare Workflows binding name.
|
|
8
|
+
* @experimental
|
|
9
|
+
*/
|
|
10
10
|
declare const agentBindingName: (exportName: string) => string;
|
|
11
11
|
/**
|
|
12
|
-
* `supportBot` → `agent-support-bot` — the default deployed workflow name.
|
|
13
|
-
* @experimental
|
|
14
|
-
*/
|
|
12
|
+
* `supportBot` → `agent-support-bot` — the default deployed workflow name.
|
|
13
|
+
* @experimental
|
|
14
|
+
*/
|
|
15
15
|
declare const agentDefaultName: (exportName: string) => string;
|
|
16
16
|
/**
|
|
17
|
-
* `support` → `SupportVoiceDO` — the generated voice-session Durable Object
|
|
18
|
-
* class name (a subclass of `VoiceSessionDO`). Distinct from the agent's
|
|
19
|
-
* `WorkflowEntrypoint` (`SupportAgentWorkflow`): the voice path is a
|
|
20
|
-
* hibernatable-WebSocket DO that runs the per-turn STT→LLM→TTS pipeline in-DO,
|
|
21
|
-
* NOT the replay-durable Workflow.
|
|
22
|
-
* @experimental
|
|
23
|
-
*/
|
|
17
|
+
* `support` → `SupportVoiceDO` — the generated voice-session Durable Object
|
|
18
|
+
* class name (a subclass of `VoiceSessionDO`). Distinct from the agent's
|
|
19
|
+
* `WorkflowEntrypoint` (`SupportAgentWorkflow`): the voice path is a
|
|
20
|
+
* hibernatable-WebSocket DO that runs the per-turn STT→LLM→TTS pipeline in-DO,
|
|
21
|
+
* NOT the replay-durable Workflow.
|
|
22
|
+
* @experimental
|
|
23
|
+
*/
|
|
24
24
|
declare const voiceClassName: (exportName: string) => string;
|
|
25
25
|
/**
|
|
26
|
-
* `support` → `VOICE_SUPPORT` — the Cloudflare Durable Object binding name for the voice session.
|
|
27
|
-
* @experimental
|
|
28
|
-
*/
|
|
26
|
+
* `support` → `VOICE_SUPPORT` — the Cloudflare Durable Object binding name for the voice session.
|
|
27
|
+
* @experimental
|
|
28
|
+
*/
|
|
29
29
|
declare const voiceBindingName: (exportName: string) => string;
|
|
30
30
|
export { agentBindingName, agentClassName, agentDefaultName, voiceBindingName, voiceClassName };
|
package/dist/naming.d.ts
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `support` → `SupportAgentWorkflow` — the generated WorkflowEntrypoint class name.
|
|
3
|
-
* @experimental
|
|
4
|
-
*/
|
|
2
|
+
* `support` → `SupportAgentWorkflow` — the generated WorkflowEntrypoint class name.
|
|
3
|
+
* @experimental
|
|
4
|
+
*/
|
|
5
5
|
declare const agentClassName: (exportName: string) => string;
|
|
6
6
|
/**
|
|
7
|
-
* `support` → `AGENT_SUPPORT` — the Cloudflare Workflows binding name.
|
|
8
|
-
* @experimental
|
|
9
|
-
*/
|
|
7
|
+
* `support` → `AGENT_SUPPORT` — the Cloudflare Workflows binding name.
|
|
8
|
+
* @experimental
|
|
9
|
+
*/
|
|
10
10
|
declare const agentBindingName: (exportName: string) => string;
|
|
11
11
|
/**
|
|
12
|
-
* `supportBot` → `agent-support-bot` — the default deployed workflow name.
|
|
13
|
-
* @experimental
|
|
14
|
-
*/
|
|
12
|
+
* `supportBot` → `agent-support-bot` — the default deployed workflow name.
|
|
13
|
+
* @experimental
|
|
14
|
+
*/
|
|
15
15
|
declare const agentDefaultName: (exportName: string) => string;
|
|
16
16
|
/**
|
|
17
|
-
* `support` → `SupportVoiceDO` — the generated voice-session Durable Object
|
|
18
|
-
* class name (a subclass of `VoiceSessionDO`). Distinct from the agent's
|
|
19
|
-
* `WorkflowEntrypoint` (`SupportAgentWorkflow`): the voice path is a
|
|
20
|
-
* hibernatable-WebSocket DO that runs the per-turn STT→LLM→TTS pipeline in-DO,
|
|
21
|
-
* NOT the replay-durable Workflow.
|
|
22
|
-
* @experimental
|
|
23
|
-
*/
|
|
17
|
+
* `support` → `SupportVoiceDO` — the generated voice-session Durable Object
|
|
18
|
+
* class name (a subclass of `VoiceSessionDO`). Distinct from the agent's
|
|
19
|
+
* `WorkflowEntrypoint` (`SupportAgentWorkflow`): the voice path is a
|
|
20
|
+
* hibernatable-WebSocket DO that runs the per-turn STT→LLM→TTS pipeline in-DO,
|
|
21
|
+
* NOT the replay-durable Workflow.
|
|
22
|
+
* @experimental
|
|
23
|
+
*/
|
|
24
24
|
declare const voiceClassName: (exportName: string) => string;
|
|
25
25
|
/**
|
|
26
|
-
* `support` → `VOICE_SUPPORT` — the Cloudflare Durable Object binding name for the voice session.
|
|
27
|
-
* @experimental
|
|
28
|
-
*/
|
|
26
|
+
* `support` → `VOICE_SUPPORT` — the Cloudflare Durable Object binding name for the voice session.
|
|
27
|
+
* @experimental
|
|
28
|
+
*/
|
|
29
29
|
declare const voiceBindingName: (exportName: string) => string;
|
|
30
30
|
export { agentBindingName, agentClassName, agentDefaultName, voiceBindingName, voiceClassName };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { LunoraError } from '@lunora/errors';
|
|
2
2
|
import { jsonSchema } from 'ai';
|
|
3
|
+
import { isDuplicateInstanceError } from '../channels.mjs';
|
|
3
4
|
import { agentBindingName } from '../naming.mjs';
|
|
4
5
|
import { toFunctionReference, DEFAULT_AGENT_FUNCTION_PATHS } from './AGENT_MODULE-Dnt_-AAT.mjs';
|
|
5
6
|
|
|
@@ -64,7 +65,10 @@ const agentAsTool = (options) => {
|
|
|
64
65
|
try {
|
|
65
66
|
const handle = await binding.create({ id: childInstanceId, params });
|
|
66
67
|
instance = await binding.get(handle.id);
|
|
67
|
-
} catch {
|
|
68
|
+
} catch (error) {
|
|
69
|
+
if (!isDuplicateInstanceError(error)) {
|
|
70
|
+
throw error;
|
|
71
|
+
}
|
|
68
72
|
instance = await binding.get(childInstanceId);
|
|
69
73
|
}
|
|
70
74
|
const terminal = await pollUntilTerminal(instance, maxPolls, pollIntervalMs, wait);
|
package/dist/packem_shared/{compileAgentWorkflow-BxJjHgtD.mjs → compileAgentWorkflow-DX90058f.mjs}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineWorkflow } from '@lunora/workflow';
|
|
2
|
-
import { runAgentLoop } from './runAgentLoop-
|
|
2
|
+
import { runAgentLoop } from './runAgentLoop-B3Q2o-Uz.mjs';
|
|
3
3
|
import { createStreamGenerate, createAgentGenerate, createEpisodeExtract, createGraphExtract, createCompact } from './createAgentGenerate-BQv9YJ01.mjs';
|
|
4
4
|
import { agentDefaultName } from '../naming.mjs';
|
|
5
5
|
import { DEFAULT_AGENT_FUNCTION_PATHS } from './AGENT_MODULE-Dnt_-AAT.mjs';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { LunoraError } from '@lunora/errors';
|
|
2
2
|
import { collectAgenticMemoryTools } from './collectAgenticMemoryTools-QrzpV-WX.mjs';
|
|
3
|
-
import { agentAsTool } from './agentAsTool-
|
|
3
|
+
import { agentAsTool } from './agentAsTool-CUHlWsmt.mjs';
|
|
4
4
|
import { i as isInjectedMemorySource } from './memory-D4FPcBsX.mjs';
|
|
5
5
|
import { SKILL_NAME_PATTERN, RESERVED_SKILL_NAME } from './defineSkill-Ctf_S-rz.mjs';
|
|
6
6
|
|
|
@@ -34,7 +34,7 @@ const graphTables = {
|
|
|
34
34
|
type: v.optional(v.string()),
|
|
35
35
|
updatedAt: v.number(),
|
|
36
36
|
weight: v.optional(v.number())
|
|
37
|
-
}).index("byOwnerName", ["owner", "name"], { unique: true }).public(),
|
|
37
|
+
}).index("byOwnerName", ["owner", "name"], { unique: true }).index("byOwnerUpdatedAt", ["owner", "updatedAt"]).public(),
|
|
38
38
|
/**
|
|
39
39
|
* Graph-memory edges — directed triples storing the normalized endpoint
|
|
40
40
|
* NAMES (no join on write), owner-scoped like the nodes. `weight` is
|
|
@@ -57,6 +57,7 @@ const DEFAULT_GRAPH_DEPTH = 2;
|
|
|
57
57
|
const DEFAULT_GRAPH_MAX_SEEDS = 4;
|
|
58
58
|
const DEFAULT_GRAPH_FAN_OUT = 8;
|
|
59
59
|
const DEFAULT_GRAPH_MAX_NODES = 32;
|
|
60
|
+
const GRAPH_SEED_SCAN_CAP = 500;
|
|
60
61
|
const WHITESPACE_RUN = /\s+/gu;
|
|
61
62
|
const NON_WORD = /[^\p{L}\p{N}]+/u;
|
|
62
63
|
const normalizeEntityName = (name) => name.trim().replaceAll(WHITESPACE_RUN, " ").toLowerCase();
|
|
@@ -186,7 +187,7 @@ const graphComponent = () => {
|
|
|
186
187
|
if (tokens.length === 0) {
|
|
187
188
|
return { context: "" };
|
|
188
189
|
}
|
|
189
|
-
const ownerEntities = await context.db.query(ENTITIES_TABLE).withIndex("
|
|
190
|
+
const ownerEntities = await context.db.query(ENTITIES_TABLE).withIndex("byOwnerUpdatedAt", (q) => q.eq("owner", args.owner)).order("desc").take(GRAPH_SEED_SCAN_CAP);
|
|
190
191
|
const seeds = ownerEntities.filter((row) => matchesSeed(row["name"], tokens)).toSorted(
|
|
191
192
|
(a, b) => (b["weight"] ?? 1) - (a["weight"] ?? 1) || a["name"].localeCompare(b["name"])
|
|
192
193
|
).slice(0, args.maxSeeds ?? DEFAULT_GRAPH_MAX_SEEDS).map((row) => row["name"]);
|
package/dist/packem_shared/{normalizeEntityName-CyEEWFkR.mjs → normalizeEntityName-BouctxLC.mjs}
RENAMED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import '@lunora/server';
|
|
2
2
|
import '@lunora/values';
|
|
3
|
-
export { b as graphComponent, g as graphTables, n as normalizeEntityName } from './graph-component-
|
|
3
|
+
export { b as graphComponent, g as graphTables, n as normalizeEntityName } from './graph-component-Bbaxxymp.mjs';
|
|
@@ -63,7 +63,7 @@ const awaitApproval = async (turnContext, call) => {
|
|
|
63
63
|
toolName: call.name
|
|
64
64
|
});
|
|
65
65
|
await patchThread({ status: "awaiting_input" });
|
|
66
|
-
const event = await step.waitForEvent(`approval:${call.id}`, { type:
|
|
66
|
+
const event = await step.waitForEvent(`approval:${call.id}`, { type: `agent-approval:${call.id}` });
|
|
67
67
|
await patchThread({ status: "running" });
|
|
68
68
|
return { decision: event.payload.decision, ...event.payload.note === void 0 ? {} : { note: event.payload.note } };
|
|
69
69
|
};
|