@lunora/agent 1.0.0-alpha.8 → 1.0.0-alpha.81

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.
Files changed (84) hide show
  1. package/dist/channels.d.mts +2 -2
  2. package/dist/channels.d.ts +2 -2
  3. package/dist/channels.mjs +1 -181
  4. package/dist/component.d.mts +2 -0
  5. package/dist/component.d.ts +2 -0
  6. package/dist/component.mjs +2 -418
  7. package/dist/inbound.d.mts +7 -5
  8. package/dist/inbound.d.ts +7 -5
  9. package/dist/inbound.mjs +1 -32
  10. package/dist/index.d.mts +49 -8
  11. package/dist/index.d.ts +49 -8
  12. package/dist/index.mjs +1 -18
  13. package/dist/naming.mjs +1 -8
  14. package/dist/packem_shared/AGENT_MODULE-M4D1EejI.mjs +1 -0
  15. package/dist/packem_shared/VoiceSessionDO-DHtOAsd9.mjs +1 -0
  16. package/dist/packem_shared/adaptMcpResult-CVlq-_TO.mjs +2 -0
  17. package/dist/packem_shared/agentAsTool-Xg7YCl5P.mjs +1 -0
  18. package/dist/packem_shared/base64-5eyBfWO3.mjs +1 -0
  19. package/dist/packem_shared/braintrustTelemetry-CoYK-pq7.mjs +1 -0
  20. package/dist/packem_shared/branch-marker-boZ00zmk.mjs +1 -0
  21. package/dist/packem_shared/buildModelMessages-Y4tGo1T9.mjs +5 -0
  22. package/dist/packem_shared/codeTool-DC62JfaY.mjs +1 -0
  23. package/dist/packem_shared/collectAgenticMemoryTools-BeMWT2qt.mjs +1 -0
  24. package/dist/packem_shared/combineTelemetry-DgE9W9G8.mjs +1 -0
  25. package/dist/packem_shared/common-CJSjtsfv.mjs +1 -0
  26. package/dist/packem_shared/compileAgentWorkflow-D4q6vB3j.mjs +1 -0
  27. package/dist/packem_shared/component-shared-IZozysYq.mjs +1 -0
  28. package/dist/packem_shared/consoleTelemetry-BZY3Y-Ly.mjs +1 -0
  29. package/dist/packem_shared/createAgentContext-iS35-Xrs.mjs +1 -0
  30. package/dist/packem_shared/createAgentGenerate-9bZ2YhpN.mjs +3 -0
  31. package/dist/packem_shared/createDispatchRunner-pLyQ70FK-2_j6ocGT.mjs +1 -0
  32. package/dist/packem_shared/defineAgent-YTqqBCP3.mjs +3 -0
  33. package/dist/packem_shared/defineSkill-DGGvDWNq.mjs +1 -0
  34. package/dist/packem_shared/functionTool-D3CP4f8-.mjs +1 -0
  35. package/dist/packem_shared/memory-JI0lUu84.mjs +1 -0
  36. package/dist/packem_shared/normalizeEntityName-Ce0X6Afj.mjs +2 -0
  37. package/dist/packem_shared/otlpTelemetry-CywiFp-X.mjs +1 -0
  38. package/dist/packem_shared/runAgentLoop-oAmn3OyN.mjs +3 -0
  39. package/dist/packem_shared/runVoiceTurn-B9EXi1BC.mjs +1 -0
  40. package/dist/packem_shared/sandboxComponent-BtOkUYpY.mjs +5 -0
  41. package/dist/packem_shared/sentryTelemetry-CPqEbFPA.mjs +1 -0
  42. package/dist/packem_shared/{types.d-boAM2Yi1.d.mts → types.d-DTKxPuh_.d.mts} +239 -22
  43. package/dist/packem_shared/{types.d-boAM2Yi1.d.ts → types.d-DTKxPuh_.d.ts} +239 -22
  44. package/dist/packem_shared/voice-turn-DhxJgQW1.mjs +1 -0
  45. package/dist/reply.d.mts +40 -0
  46. package/dist/reply.d.ts +40 -0
  47. package/dist/reply.mjs +1 -0
  48. package/dist/sandbox.d.mts +14 -13
  49. package/dist/sandbox.d.ts +14 -13
  50. package/dist/sandbox.mjs +1 -113
  51. package/dist/skill-markdown.d.mts +36 -0
  52. package/dist/skill-markdown.d.ts +36 -0
  53. package/dist/skill-markdown.mjs +1 -0
  54. package/dist/telemetry/index.d.mts +64 -1
  55. package/dist/telemetry/index.d.ts +64 -1
  56. package/dist/telemetry/index.mjs +1 -5
  57. package/package.json +18 -9
  58. package/dist/packem_shared/AGENT_MODULE-Dnt_-AAT.mjs +0 -24
  59. package/dist/packem_shared/VoiceSessionDO-DLoXsHGF.mjs +0 -297
  60. package/dist/packem_shared/adaptMcpResult-wtNMvLoP.mjs +0 -65
  61. package/dist/packem_shared/agentAsTool-CUHlWsmt.mjs +0 -98
  62. package/dist/packem_shared/base64-BVwtgRJV.mjs +0 -18
  63. package/dist/packem_shared/braintrustTelemetry-wuGDErob.mjs +0 -47
  64. package/dist/packem_shared/buildModelMessages-BWFigaoo.mjs +0 -69
  65. package/dist/packem_shared/codeTool-CjgJOC9t.mjs +0 -122
  66. package/dist/packem_shared/collectAgenticMemoryTools-QrzpV-WX.mjs +0 -97
  67. package/dist/packem_shared/combineTelemetry-DCyaaWAI.mjs +0 -43
  68. package/dist/packem_shared/common-DAeFCot5.mjs +0 -61
  69. package/dist/packem_shared/compileAgentWorkflow-DXNKigj0.mjs +0 -75
  70. package/dist/packem_shared/consoleTelemetry-z2MiP1jt.mjs +0 -93
  71. package/dist/packem_shared/createAgentContext-4xJGXNR4.mjs +0 -50
  72. package/dist/packem_shared/createAgentGenerate-BQv9YJ01.mjs +0 -192
  73. package/dist/packem_shared/createDispatchRunner-DSbp_dph-ZHTtxy3f.mjs +0 -69
  74. package/dist/packem_shared/defineAgent-DAwAZC9P.mjs +0 -148
  75. package/dist/packem_shared/defineSkill-Ctf_S-rz.mjs +0 -22
  76. package/dist/packem_shared/functionTool-D6lCa2jB.mjs +0 -20
  77. package/dist/packem_shared/graph-component-Bbaxxymp.mjs +0 -217
  78. package/dist/packem_shared/memory-D4FPcBsX.mjs +0 -12
  79. package/dist/packem_shared/normalizeEntityName-BouctxLC.mjs +0 -3
  80. package/dist/packem_shared/otlpTelemetry-9ypXork9.mjs +0 -163
  81. package/dist/packem_shared/runAgentLoop-B3Q2o-Uz.mjs +0 -493
  82. package/dist/packem_shared/runVoiceTurn-LnqLvCRR.mjs +0 -211
  83. package/dist/packem_shared/sandboxComponent-DR3pTwBL.mjs +0 -194
  84. package/dist/packem_shared/sentryTelemetry-CgqFJyLO.mjs +0 -36
package/dist/sandbox.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { a as AgentToolContext, b as AgentToolDefinition } from "./packem_shared/types.d-boAM2Yi1.js";
1
+ import { b as AgentToolContext, c as AgentToolDefinition } from "./packem_shared/types.d-DTKxPuh_.js";
2
2
  import '@lunora/mail/inbound';
3
3
  import 'ai';
4
4
  /**
@@ -25,8 +25,8 @@ type BrowserToolInput = {
25
25
  /**
26
26
  * The model-provided input to a {@link containerTool} call — a discriminated
27
27
  * union on `op`. `fetch` sends an HTTP request to the container; `exec` asks it
28
- * to run a command (routed as a POST to `/exec`, since the container surface
29
- * exposes no first-class exec RPC — the container app must serve that route).
28
+ * to run a command (delegated to `ctx.containers.<name>.exec`, the first-class
29
+ * exec contract in `@lunora/container`; the container app serves its route).
30
30
  * @experimental
31
31
  */
32
32
  type ContainerToolInput = {
@@ -112,12 +112,13 @@ interface ContainerToolOptions {
112
112
  description?: string;
113
113
  /**
114
114
  * Gate a call behind a human approval. Defaults to gating any command
115
- * execution: an `exec`, AND a `fetch` whose path resolves to the privileged
116
- * `/exec` route (both reach the same command-execution path in the container,
117
- * so gating on the `op` name alone would let a `fetch` to `/exec` run a
118
- * command unattended). A plain `fetch` to any other route runs unattended.
119
- * Pass a boolean or your own predicate to change that. Evaluated from
120
- * replay-stable input, so keep it deterministic.
115
+ * execution an `exec` plus any `fetch` using a non-idempotent method
116
+ * (POST/PUT/PATCH/DELETE), so a prompt-injected model cannot reach some
117
+ * other mutating route unattended. A read-only `fetch` runs unattended. The
118
+ * exec route itself needs no special case: `@lunora/container` reserves
119
+ * `/__lunora/*` and refuses a `fetch` into it. Pass a boolean or your own
120
+ * predicate to change that. Evaluated from replay-stable input, so keep it
121
+ * deterministic.
121
122
  */
122
123
  needsApproval?: ((input: ContainerToolInput) => boolean) | boolean;
123
124
  }
@@ -149,19 +150,19 @@ interface ContainerToolOptions {
149
150
  declare const browserTool: (options?: BrowserToolOptions) => AgentToolDefinition<BrowserToolInput, string>;
150
151
  /**
151
152
  * A batteries-included agent tool that talks to a declared Cloudflare
152
- * Container. `name` is the `ctx.containers.&lt;name>` key (the `lunora/containers.ts`
153
+ * Container. `name` is the `ctx.containers.<name>` key (the `lunora/containers.ts`
153
154
  * export). One tool exposes `fetch` (HTTP request) and `exec` (run a command);
154
155
  * the model picks via `op`. The call dispatches to the auto-registered
155
156
  * `sandbox:invoke` action, which carries `ctx.containers`.
156
157
  *
157
158
  * By default a read-only (GET/HEAD/OPTIONS, or method-omitted) `fetch` runs
158
159
  * unattended while everything else is gated behind a human approval — an
159
- * `exec`; a `fetch` whose path resolves to the privileged `/exec` route (both
160
+ * `exec`; a `fetch` whose path resolves to the privileged exec route (both
160
161
  * reach the same command-execution path in the container, so gating on the
161
- * `op` name alone would let a `fetch` to `/exec` run a command unattended);
162
+ * `op` name alone would let a `fetch` to it run a command unattended);
162
163
  * and a `fetch` using a non-idempotent method (POST/PUT/PATCH/DELETE) to ANY
163
164
  * route, since a prompt-injected model could otherwise mutate container state
164
- * through some other privileged route just by avoiding the literal `/exec`
165
+ * through some other privileged route just by avoiding the literal exec
165
166
  * path. A `fetch` can still reach any *other read* route unattended, so scope
166
167
  * the container's GET routes accordingly. Pass `opts.needsApproval` to widen
167
168
  * or disable the gate.
package/dist/sandbox.mjs CHANGED
@@ -1,113 +1 @@
1
- import { LunoraError } from '@lunora/errors';
2
- import { jsonSchema } from 'ai';
3
- import { toFunctionReference, SANDBOX_INVOKE_PATH } from './packem_shared/AGENT_MODULE-Dnt_-AAT.mjs';
4
-
5
- const SANDBOX_REF = toFunctionReference(SANDBOX_INVOKE_PATH);
6
- const DEFAULT_BROWSER_DESCRIPTION = 'Drive a headless browser: screenshot a page, render it to PDF, read its HTML content, or scrape it. Set `op` to "screenshot" | "pdf" | "content" | "scrape" and pass the target `url`.';
7
- const DEFAULT_CONTAINER_DESCRIPTION = 'Talk to a sandboxed container: `fetch` an HTTP path on it, or `exec` a command inside it. Set `op` to "fetch" (with `path`) or "exec" (with `command`).';
8
- const DEFAULT_FS_DESCRIPTION = 'Read and write files in a persistent sandbox filesystem. Set `op` to "ls" (list a directory), "read", "write" (with `content`), "rm", or "stat", and pass `path`.';
9
- const defaultFsGate = (input) => input.op === "write" || input.op === "rm";
10
- const FS_TOOL_SCHEMA = jsonSchema({
11
- properties: {
12
- content: { description: "write: the file contents.", type: "string" },
13
- op: { description: "The filesystem operation to run.", enum: ["ls", "read", "write", "rm", "stat"], type: "string" },
14
- path: { description: "The file or directory path, relative to the sandbox root.", type: "string" }
15
- },
16
- required: ["op"],
17
- type: "object"
18
- });
19
- const BROWSER_TOOL_SCHEMA = jsonSchema({
20
- properties: {
21
- fullPage: { description: "screenshot: capture the full scrollable page rather than just the viewport.", type: "boolean" },
22
- op: { description: "The browser operation to run.", enum: ["screenshot", "scrape", "pdf", "content"], type: "string" },
23
- selector: { description: "scrape: optional CSS selector hint to narrow the extraction.", type: "string" },
24
- type: { description: "screenshot: image encoding (default png).", enum: ["png", "jpeg"], type: "string" },
25
- url: { description: "The URL to operate on.", type: "string" }
26
- },
27
- required: ["op", "url"],
28
- type: "object"
29
- });
30
- const CONTAINER_EXEC_ROUTE = "/exec";
31
- const CONTAINER_PATH_QUERY_SPLIT = /[?#]/u;
32
- const normalizeContainerPath = (path) => {
33
- const [raw = ""] = (path ?? "").split(CONTAINER_PATH_QUERY_SPLIT);
34
- const segments = [];
35
- for (const segment of raw.split("/")) {
36
- if (segment === "" || segment === ".") {
37
- continue;
38
- }
39
- if (segment === "..") {
40
- segments.pop();
41
- continue;
42
- }
43
- segments.push(segment);
44
- }
45
- return `/${segments.join("/")}`;
46
- };
47
- const NON_IDEMPOTENT_METHODS = /* @__PURE__ */ new Set(["DELETE", "PATCH", "POST", "PUT"]);
48
- const defaultContainerGate = (input) => {
49
- if (input.op === "exec") {
50
- return true;
51
- }
52
- if (normalizeContainerPath(input.path) === CONTAINER_EXEC_ROUTE) {
53
- return true;
54
- }
55
- return NON_IDEMPOTENT_METHODS.has((input.method ?? "GET").toUpperCase());
56
- };
57
- const CONTAINER_TOOL_SCHEMA = jsonSchema({
58
- properties: {
59
- args: { description: "exec: command arguments.", items: { type: "string" }, type: "array" },
60
- body: { description: "fetch: request body.", type: "string" },
61
- command: { description: "exec: the command to run.", type: "string" },
62
- method: { description: "fetch: HTTP method (default GET).", type: "string" },
63
- op: { description: "The container operation to run.", enum: ["fetch", "exec"], type: "string" },
64
- path: { description: "fetch: request path on the container (e.g. /health).", type: "string" }
65
- },
66
- required: ["op"],
67
- type: "object"
68
- });
69
- const browserTool = (options = {}) => {
70
- return {
71
- description: options.description ?? DEFAULT_BROWSER_DESCRIPTION,
72
- // Pin `kind` LAST so out-of-schema model input can never override it.
73
- execute: (input, context) => context.run(SANDBOX_REF, { ...input, kind: "browser" }),
74
- inputSchema: BROWSER_TOOL_SCHEMA,
75
- isLunoraAgentTool: true,
76
- ...options.needsApproval === void 0 ? {} : { needsApproval: options.needsApproval }
77
- };
78
- };
79
- const containerTool = (name, options = {}) => {
80
- if (typeof name !== "string" || name.length === 0) {
81
- throw new LunoraError("INTERNAL", "@lunora/agent: containerTool requires a container `name` (the ctx.containers.<name> key from lunora/containers.ts)");
82
- }
83
- const needsApproval = options.needsApproval ?? defaultContainerGate;
84
- return {
85
- description: options.description ?? DEFAULT_CONTAINER_DESCRIPTION,
86
- // Pin `kind`/`name` LAST so out-of-schema model input can never override
87
- // the authoritative container the author pinned.
88
- execute: (input, context) => context.run(SANDBOX_REF, { ...input, kind: "container", name }),
89
- inputSchema: CONTAINER_TOOL_SCHEMA,
90
- isLunoraAgentTool: true,
91
- needsApproval
92
- };
93
- };
94
- const fsTool = (bucket, options = {}) => {
95
- if (typeof bucket !== "string" || bucket.length === 0) {
96
- throw new LunoraError("INTERNAL", "@lunora/agent: fsTool requires an R2 `bucket` binding name (the r2_bucket declared in wrangler.jsonc)");
97
- }
98
- return {
99
- description: options.description ?? DEFAULT_FS_DESCRIPTION,
100
- // Pin kind/bucket/root LAST so out-of-schema model input can never override
101
- // the authoritative bucket + sandbox root the author pinned. `root` may be
102
- // a function of the ctx (per-run/owner isolation), resolved here.
103
- execute: (input, context) => {
104
- const root = typeof options.root === "function" ? options.root(context) : options.root ?? "";
105
- return context.run(SANDBOX_REF, { ...input, bucket, kind: "fs", root });
106
- },
107
- inputSchema: FS_TOOL_SCHEMA,
108
- isLunoraAgentTool: true,
109
- needsApproval: options.needsApproval ?? defaultFsGate
110
- };
111
- };
112
-
113
- export { browserTool, containerTool, fsTool };
1
+ import{LunoraError as a}from"@lunora/errors";import{jsonSchema as i}from"ai";import{toFunctionReference as p,SANDBOX_INVOKE_PATH as c}from"./packem_shared/AGENT_MODULE-M4D1EejI.mjs";const s=p(c),d='Drive a headless browser: screenshot a page, render it to PDF, read its HTML content, or scrape it. Set `op` to "screenshot" | "pdf" | "content" | "scrape" and pass the target `url`.',h='Talk to a sandboxed container: `fetch` an HTTP path on it, or `exec` a command inside it. Set `op` to "fetch" (with `path`) or "exec" (with `command`).',l='Read and write files in a persistent sandbox filesystem. Set `op` to "ls" (list a directory), "read", "write" (with `content`), "rm", or "stat", and pass `path`.',u=e=>e.op==="write"||e.op==="rm",T=i({properties:{content:{description:"write: the file contents.",type:"string"},op:{description:"The filesystem operation to run.",enum:["ls","read","write","rm","stat"],type:"string"},path:{description:"The file or directory path, relative to the sandbox root.",type:"string"}},required:["op"],type:"object"}),m=i({properties:{fullPage:{description:"screenshot: capture the full scrollable page rather than just the viewport.",type:"boolean"},op:{description:"The browser operation to run.",enum:["screenshot","scrape","pdf","content"],type:"string"},selector:{description:"scrape: optional CSS selector hint to narrow the extraction.",type:"string"},type:{description:"screenshot: image encoding (default png).",enum:["png","jpeg"],type:"string"},url:{description:"The URL to operate on.",type:"string"}},required:["op","url"],type:"object"}),g=new Set(["DELETE","PATCH","POST","PUT"]),f=e=>e.op==="exec"||g.has((e.method??"GET").toUpperCase()),y=i({properties:{args:{description:"exec: command arguments.",items:{type:"string"},type:"array"},body:{description:"fetch: request body.",type:"string"},command:{description:"exec: the command to run.",type:"string"},method:{description:"fetch: HTTP method (default GET).",type:"string"},op:{description:"The container operation to run.",enum:["fetch","exec"],type:"string"},path:{description:"fetch: request path on the container (e.g. /health).",type:"string"}},required:["op"],type:"object"}),w=(e={})=>({description:e.description??d,execute:(t,r)=>r.run(s,{...t,kind:"browser"}),inputSchema:m,isLunoraAgentTool:!0,...e.needsApproval===void 0?{}:{needsApproval:e.needsApproval}}),O=(e,t={})=>{if(typeof e!="string"||e.length===0)throw new a("INTERNAL","@lunora/agent: containerTool requires a container `name` (the ctx.containers.<name> key from lunora/containers.ts)");const r=t.needsApproval??f;return{description:t.description??h,execute:(o,n)=>n.run(s,{...o,kind:"container",name:e}),inputSchema:y,isLunoraAgentTool:!0,needsApproval:r}},_=(e,t={})=>{if(typeof e!="string"||e.length===0)throw new a("INTERNAL","@lunora/agent: fsTool requires an R2 `bucket` binding name (the r2_bucket declared in wrangler.jsonc)");return{description:t.description??l,execute:(r,o)=>{const n=typeof t.root=="function"?t.root(o):t.root??"";return o.run(s,{...r,bucket:e,kind:"fs",root:n})},inputSchema:T,isLunoraAgentTool:!0,needsApproval:t.needsApproval??u}};export{w as browserTool,O as containerTool,_ as fsTool};
@@ -0,0 +1,36 @@
1
+ import { S as SkillMarkdownExtras, d as SkillDefinition } from "./packem_shared/types.d-DTKxPuh_.mjs";
2
+ import '@lunora/mail/inbound';
3
+ import 'ai';
4
+ /**
5
+ * Declare a skill whose prose lives in a markdown file.
6
+ *
7
+ * ```ts
8
+ * import triage from "./skills/triage/SKILL.md?raw";
9
+ * import { functionTool } from "@lunora/agent";
10
+ * import { skillFromMarkdown } from "@lunora/agent/skill-markdown";
11
+ *
12
+ * export const triageSkill = skillFromMarkdown(triage, {
13
+ * tools: { searchCode: functionTool(api.code.search, { ... }) },
14
+ * });
15
+ * ```
16
+ *
17
+ * ```md
18
+ * ---
19
+ * name: triage
20
+ * ---
21
+ * Reproduce the report before proposing a cause. Cite the failing test.
22
+ * ```
23
+ *
24
+ * The split is the point: the instructions are the part a non-author reads,
25
+ * reviews and copies between projects, so they belong in a file that is legible
26
+ * on its own — and the `name` travels WITH that file, so a skill can move
27
+ * without a matching TypeScript wrapper. Tools and `knowledge` stay in code,
28
+ * because they are code.
29
+ *
30
+ * Getting the markdown here is the caller's job (`?raw` under Vite, a build-time
31
+ * import elsewhere) — a Worker has no filesystem to read it from at runtime, so
32
+ * this takes the string rather than a path.
33
+ * @experimental
34
+ */
35
+ declare const skillFromMarkdown: (markdown: string, extras?: SkillMarkdownExtras) => SkillDefinition;
36
+ export { type SkillMarkdownExtras, skillFromMarkdown };
@@ -0,0 +1,36 @@
1
+ import { S as SkillMarkdownExtras, d as SkillDefinition } from "./packem_shared/types.d-DTKxPuh_.js";
2
+ import '@lunora/mail/inbound';
3
+ import 'ai';
4
+ /**
5
+ * Declare a skill whose prose lives in a markdown file.
6
+ *
7
+ * ```ts
8
+ * import triage from "./skills/triage/SKILL.md?raw";
9
+ * import { functionTool } from "@lunora/agent";
10
+ * import { skillFromMarkdown } from "@lunora/agent/skill-markdown";
11
+ *
12
+ * export const triageSkill = skillFromMarkdown(triage, {
13
+ * tools: { searchCode: functionTool(api.code.search, { ... }) },
14
+ * });
15
+ * ```
16
+ *
17
+ * ```md
18
+ * ---
19
+ * name: triage
20
+ * ---
21
+ * Reproduce the report before proposing a cause. Cite the failing test.
22
+ * ```
23
+ *
24
+ * The split is the point: the instructions are the part a non-author reads,
25
+ * reviews and copies between projects, so they belong in a file that is legible
26
+ * on its own — and the `name` travels WITH that file, so a skill can move
27
+ * without a matching TypeScript wrapper. Tools and `knowledge` stay in code,
28
+ * because they are code.
29
+ *
30
+ * Getting the markdown here is the caller's job (`?raw` under Vite, a build-time
31
+ * import elsewhere) — a Worker has no filesystem to read it from at runtime, so
32
+ * this takes the string rather than a path.
33
+ * @experimental
34
+ */
35
+ declare const skillFromMarkdown: (markdown: string, extras?: SkillMarkdownExtras) => SkillDefinition;
36
+ export { type SkillMarkdownExtras, skillFromMarkdown };
@@ -0,0 +1 @@
1
+ import{LunoraError as o}from"@lunora/errors";import{parse as s}from"yaml";import{defineSkill as l}from"./packem_shared/defineSkill-DGGvDWNq.mjs";const m=/^\uFEFF?[ \t]*---[ \t]*\r?\n/u,h=/^---[ \t]*$/mu,c=t=>{const r=m.exec(t);if(!r)return{body:t.trim(),data:{}};const n=t.slice(r[0].length),e=h.exec(n);if(!e)throw new o("INTERNAL","@lunora/agent: the skill markdown opens with `---` but never closes the frontmatter block. Add a closing `---` on its own line.");let a;try{a=s(n.slice(0,e.index))}catch(i){throw new o("INTERNAL",`@lunora/agent: the skill markdown has invalid YAML frontmatter — ${i instanceof Error?i.message:String(i)}`)}return{body:n.slice(e.index+e[0].length).trim(),data:typeof a=="object"&&a!==null?a:{}}},w=(t,r={})=>{if(typeof t!="string")throw new o("INTERNAL",`@lunora/agent: skillFromMarkdown expects the markdown SOURCE as a string, got ${typeof t}`);const{body:n,data:e}=c(t);if(e.name!==void 0&&typeof e.name!="string")throw new o("INTERNAL",`@lunora/agent: the skill markdown's \`name\` must be a string, got ${Array.isArray(e.name)?"array":typeof e.name}. Quote it if the value looks like a number or a boolean (\`name: "2fa"\`).`);if(typeof e.name!="string")throw new o("INTERNAL","@lunora/agent: skillFromMarkdown found no `name` in the markdown frontmatter. Open the file with a `---` line, put `name: <identifier>` on its own line, and close it with `---`. Other keys are parsed and ignored — only `name` is read here.");if(n==="")throw new o("INTERNAL",`@lunora/agent: the skill markdown for "${e.name}" has no body — the instructions below the closing \`---\` are what the skill contributes.`);return l({...r,instructions:n,name:e.name})};export{w as skillFromMarkdown};
@@ -127,6 +127,15 @@ declare const consoleTelemetry: (options?: ConsoleTelemetryOptions) => Telemetry
127
127
  * @experimental
128
128
  */
129
129
  interface OtlpTelemetryOptions extends CommonOptions {
130
+ /**
131
+ * Conversation / session id to tag each generation span with, emitted as the
132
+ * `gen_ai.conversation.id` semantic-convention attribute so a multi-turn
133
+ * conversation's model turns group in the trace store. On a deployed agent the
134
+ * platform wiring passes the run's `threadKey` here automatically (one thread =
135
+ * one conversation). Omitted → the attribute is absent (backward-compatible),
136
+ * and each turn's span is ungrouped.
137
+ */
138
+ conversationId?: string;
130
139
  /**
131
140
  * The OTLP-over-HTTP collector base endpoint (e.g. the Lunora Cloud's `/v1`
132
141
  * base). Spans are POSTed to `${endpoint}/v1/traces`; a trailing slash is
@@ -242,4 +251,58 @@ interface SentryTelemetryOptions extends CommonOptions {
242
251
  * @experimental
243
252
  */
244
253
  declare const sentryTelemetry: (options: SentryTelemetryOptions) => Telemetry;
245
- export { type BraintrustLike, type BraintrustSpan, type BraintrustTelemetryOptions, type CommonOptions, type ConsoleLogLevel, type ConsoleLogger, type ConsoleTelemetryOptions, type OtlpTelemetryOptions, type SentryLike, type SentryTelemetryOptions, braintrustTelemetry, combineTelemetry, consoleTelemetry, otlpTelemetry, sentryTelemetry };
254
+ export {
255
+ /**
256
+ * `@lunora/agent/telemetry` — observability integrations for `@lunora/agent`.
257
+ *
258
+ * Every export here produces an ai@7 `Telemetry` object suitable for the
259
+ * `integrations` array of `TelemetryOptions` (`defineAgent({ telemetry: {
260
+ * isEnabled: true, integrations: [...] } })`). `consoleTelemetry` is a
261
+ * zero-dependency structured console tracer; `combineTelemetry` fans the
262
+ * lifecycle out to several integrations and nests their execution wrappers;
263
+ * `sentryTelemetry` / `braintrustTelemetry` are dependency-injected bridges (the
264
+ * app passes its own Sentry namespace / Braintrust logger, so the heavy SDKs are
265
+ * never imported here); and `otlpTelemetry` ships `gen_ai.*` spans over
266
+ * OTLP-over-HTTP to any collector (the Lunora Cloud, or your own), so agent
267
+ * generations land in the same trace store as the rest of the app.
268
+ *
269
+ * All integrations are privacy-safe by default (`recordInputs` / `recordOutputs`
270
+ * both default `false`), so nothing sensitive is recorded without opt-in.
271
+ */
272
+ type BraintrustLike,
273
+ /**
274
+ * `@lunora/agent/telemetry` — observability integrations for `@lunora/agent`.
275
+ *
276
+ * Every export here produces an ai@7 `Telemetry` object suitable for the
277
+ * `integrations` array of `TelemetryOptions` (`defineAgent({ telemetry: {
278
+ * isEnabled: true, integrations: [...] } })`). `consoleTelemetry` is a
279
+ * zero-dependency structured console tracer; `combineTelemetry` fans the
280
+ * lifecycle out to several integrations and nests their execution wrappers;
281
+ * `sentryTelemetry` / `braintrustTelemetry` are dependency-injected bridges (the
282
+ * app passes its own Sentry namespace / Braintrust logger, so the heavy SDKs are
283
+ * never imported here); and `otlpTelemetry` ships `gen_ai.*` spans over
284
+ * OTLP-over-HTTP to any collector (the Lunora Cloud, or your own), so agent
285
+ * generations land in the same trace store as the rest of the app.
286
+ *
287
+ * All integrations are privacy-safe by default (`recordInputs` / `recordOutputs`
288
+ * both default `false`), so nothing sensitive is recorded without opt-in.
289
+ */
290
+ type BraintrustSpan,
291
+ /**
292
+ * `@lunora/agent/telemetry` — observability integrations for `@lunora/agent`.
293
+ *
294
+ * Every export here produces an ai@7 `Telemetry` object suitable for the
295
+ * `integrations` array of `TelemetryOptions` (`defineAgent({ telemetry: {
296
+ * isEnabled: true, integrations: [...] } })`). `consoleTelemetry` is a
297
+ * zero-dependency structured console tracer; `combineTelemetry` fans the
298
+ * lifecycle out to several integrations and nests their execution wrappers;
299
+ * `sentryTelemetry` / `braintrustTelemetry` are dependency-injected bridges (the
300
+ * app passes its own Sentry namespace / Braintrust logger, so the heavy SDKs are
301
+ * never imported here); and `otlpTelemetry` ships `gen_ai.*` spans over
302
+ * OTLP-over-HTTP to any collector (the Lunora Cloud, or your own), so agent
303
+ * generations land in the same trace store as the rest of the app.
304
+ *
305
+ * All integrations are privacy-safe by default (`recordInputs` / `recordOutputs`
306
+ * both default `false`), so nothing sensitive is recorded without opt-in.
307
+ */
308
+ type BraintrustTelemetryOptions, type CommonOptions, type ConsoleLogLevel, type ConsoleLogger, type ConsoleTelemetryOptions, type OtlpTelemetryOptions, type SentryLike, type SentryTelemetryOptions, braintrustTelemetry, combineTelemetry, consoleTelemetry, otlpTelemetry, sentryTelemetry };
@@ -127,6 +127,15 @@ declare const consoleTelemetry: (options?: ConsoleTelemetryOptions) => Telemetry
127
127
  * @experimental
128
128
  */
129
129
  interface OtlpTelemetryOptions extends CommonOptions {
130
+ /**
131
+ * Conversation / session id to tag each generation span with, emitted as the
132
+ * `gen_ai.conversation.id` semantic-convention attribute so a multi-turn
133
+ * conversation's model turns group in the trace store. On a deployed agent the
134
+ * platform wiring passes the run's `threadKey` here automatically (one thread =
135
+ * one conversation). Omitted → the attribute is absent (backward-compatible),
136
+ * and each turn's span is ungrouped.
137
+ */
138
+ conversationId?: string;
130
139
  /**
131
140
  * The OTLP-over-HTTP collector base endpoint (e.g. the Lunora Cloud's `/v1`
132
141
  * base). Spans are POSTed to `${endpoint}/v1/traces`; a trailing slash is
@@ -242,4 +251,58 @@ interface SentryTelemetryOptions extends CommonOptions {
242
251
  * @experimental
243
252
  */
244
253
  declare const sentryTelemetry: (options: SentryTelemetryOptions) => Telemetry;
245
- export { type BraintrustLike, type BraintrustSpan, type BraintrustTelemetryOptions, type CommonOptions, type ConsoleLogLevel, type ConsoleLogger, type ConsoleTelemetryOptions, type OtlpTelemetryOptions, type SentryLike, type SentryTelemetryOptions, braintrustTelemetry, combineTelemetry, consoleTelemetry, otlpTelemetry, sentryTelemetry };
254
+ export {
255
+ /**
256
+ * `@lunora/agent/telemetry` — observability integrations for `@lunora/agent`.
257
+ *
258
+ * Every export here produces an ai@7 `Telemetry` object suitable for the
259
+ * `integrations` array of `TelemetryOptions` (`defineAgent({ telemetry: {
260
+ * isEnabled: true, integrations: [...] } })`). `consoleTelemetry` is a
261
+ * zero-dependency structured console tracer; `combineTelemetry` fans the
262
+ * lifecycle out to several integrations and nests their execution wrappers;
263
+ * `sentryTelemetry` / `braintrustTelemetry` are dependency-injected bridges (the
264
+ * app passes its own Sentry namespace / Braintrust logger, so the heavy SDKs are
265
+ * never imported here); and `otlpTelemetry` ships `gen_ai.*` spans over
266
+ * OTLP-over-HTTP to any collector (the Lunora Cloud, or your own), so agent
267
+ * generations land in the same trace store as the rest of the app.
268
+ *
269
+ * All integrations are privacy-safe by default (`recordInputs` / `recordOutputs`
270
+ * both default `false`), so nothing sensitive is recorded without opt-in.
271
+ */
272
+ type BraintrustLike,
273
+ /**
274
+ * `@lunora/agent/telemetry` — observability integrations for `@lunora/agent`.
275
+ *
276
+ * Every export here produces an ai@7 `Telemetry` object suitable for the
277
+ * `integrations` array of `TelemetryOptions` (`defineAgent({ telemetry: {
278
+ * isEnabled: true, integrations: [...] } })`). `consoleTelemetry` is a
279
+ * zero-dependency structured console tracer; `combineTelemetry` fans the
280
+ * lifecycle out to several integrations and nests their execution wrappers;
281
+ * `sentryTelemetry` / `braintrustTelemetry` are dependency-injected bridges (the
282
+ * app passes its own Sentry namespace / Braintrust logger, so the heavy SDKs are
283
+ * never imported here); and `otlpTelemetry` ships `gen_ai.*` spans over
284
+ * OTLP-over-HTTP to any collector (the Lunora Cloud, or your own), so agent
285
+ * generations land in the same trace store as the rest of the app.
286
+ *
287
+ * All integrations are privacy-safe by default (`recordInputs` / `recordOutputs`
288
+ * both default `false`), so nothing sensitive is recorded without opt-in.
289
+ */
290
+ type BraintrustSpan,
291
+ /**
292
+ * `@lunora/agent/telemetry` — observability integrations for `@lunora/agent`.
293
+ *
294
+ * Every export here produces an ai@7 `Telemetry` object suitable for the
295
+ * `integrations` array of `TelemetryOptions` (`defineAgent({ telemetry: {
296
+ * isEnabled: true, integrations: [...] } })`). `consoleTelemetry` is a
297
+ * zero-dependency structured console tracer; `combineTelemetry` fans the
298
+ * lifecycle out to several integrations and nests their execution wrappers;
299
+ * `sentryTelemetry` / `braintrustTelemetry` are dependency-injected bridges (the
300
+ * app passes its own Sentry namespace / Braintrust logger, so the heavy SDKs are
301
+ * never imported here); and `otlpTelemetry` ships `gen_ai.*` spans over
302
+ * OTLP-over-HTTP to any collector (the Lunora Cloud, or your own), so agent
303
+ * generations land in the same trace store as the rest of the app.
304
+ *
305
+ * All integrations are privacy-safe by default (`recordInputs` / `recordOutputs`
306
+ * both default `false`), so nothing sensitive is recorded without opt-in.
307
+ */
308
+ type BraintrustTelemetryOptions, type CommonOptions, type ConsoleLogLevel, type ConsoleLogger, type ConsoleTelemetryOptions, type OtlpTelemetryOptions, type SentryLike, type SentryTelemetryOptions, braintrustTelemetry, combineTelemetry, consoleTelemetry, otlpTelemetry, sentryTelemetry };
@@ -1,5 +1 @@
1
- export { braintrustTelemetry } from '../packem_shared/braintrustTelemetry-wuGDErob.mjs';
2
- export { combineTelemetry } from '../packem_shared/combineTelemetry-DCyaaWAI.mjs';
3
- export { consoleTelemetry } from '../packem_shared/consoleTelemetry-z2MiP1jt.mjs';
4
- export { otlpTelemetry } from '../packem_shared/otlpTelemetry-9ypXork9.mjs';
5
- export { sentryTelemetry } from '../packem_shared/sentryTelemetry-CgqFJyLO.mjs';
1
+ import{braintrustTelemetry as o}from"../packem_shared/braintrustTelemetry-CoYK-pq7.mjs";import{combineTelemetry as m}from"../packem_shared/combineTelemetry-DgE9W9G8.mjs";import{consoleTelemetry as p}from"../packem_shared/consoleTelemetry-BZY3Y-Ly.mjs";import{otlpTelemetry as f}from"../packem_shared/otlpTelemetry-CywiFp-X.mjs";import{sentryTelemetry as T}from"../packem_shared/sentryTelemetry-CPqEbFPA.mjs";export{o as braintrustTelemetry,m as combineTelemetry,p as consoleTelemetry,f as otlpTelemetry,T as sentryTelemetry};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lunora/agent",
3
- "version": "1.0.0-alpha.8",
3
+ "version": "1.0.0-alpha.81",
4
4
  "description": "Durable AI agents for Lunora: defineAgent compiles a replay-safe tool-loop onto Cloudflare Workflows, with DO SQLite threads and live message subscriptions",
5
5
  "keywords": [
6
6
  "agent",
@@ -62,6 +62,14 @@
62
62
  "types": "./dist/naming.d.ts",
63
63
  "import": "./dist/naming.mjs"
64
64
  },
65
+ "./skill-markdown": {
66
+ "types": "./dist/skill-markdown.d.ts",
67
+ "import": "./dist/skill-markdown.mjs"
68
+ },
69
+ "./reply": {
70
+ "types": "./dist/reply.d.ts",
71
+ "import": "./dist/reply.mjs"
72
+ },
65
73
  "./sandbox": {
66
74
  "types": "./dist/sandbox.d.ts",
67
75
  "import": "./dist/sandbox.mjs"
@@ -76,14 +84,15 @@
76
84
  "access": "public"
77
85
  },
78
86
  "dependencies": {
79
- "@lunora/ai": "1.0.0-alpha.19",
80
- "@lunora/errors": "1.0.0-alpha.6",
81
- "@lunora/mail": "1.0.0-alpha.16",
82
- "@lunora/server": "1.0.0-alpha.29",
83
- "@lunora/values": "1.0.0-alpha.9",
84
- "@lunora/workflow": "1.0.0-alpha.11",
85
- "@modelcontextprotocol/sdk": "^1.29.0",
86
- "ai": "7.0.31"
87
+ "@lunora/ai": "1.0.0-alpha.69",
88
+ "@lunora/errors": "1.0.0-alpha.29",
89
+ "@lunora/mail": "1.0.0-alpha.59",
90
+ "@lunora/server": "1.0.0-alpha.99",
91
+ "@lunora/values": "1.0.0-alpha.37",
92
+ "@lunora/workflow": "1.0.0-alpha.42",
93
+ "@modelcontextprotocol/sdk": "^1.30.0",
94
+ "ai": "7.0.59",
95
+ "yaml": "^2.9.0"
87
96
  },
88
97
  "engines": {
89
98
  "node": "^22.15.0 || >=24.11.0"
@@ -1,24 +0,0 @@
1
- const AGENT_MODULE = "agents";
2
- const SANDBOX_MODULE = "sandbox";
3
- const SANDBOX_INVOKE_PATH = `${SANDBOX_MODULE}:invoke`;
4
- const DEFAULT_AGENT_FUNCTION_PATHS = {
5
- appendMessage: `${AGENT_MODULE}:agentAppendMessage`,
6
- ensureThread: `${AGENT_MODULE}:agentEnsureThread`,
7
- episodeRecall: `${AGENT_MODULE}:agentEpisodeRecall`,
8
- episodeUpsert: `${AGENT_MODULE}:agentEpisodeUpsert`,
9
- graphTraverse: `${AGENT_MODULE}:agentGraphTraverse`,
10
- graphUpsert: `${AGENT_MODULE}:agentGraphUpsert`,
11
- listMessages: `${AGENT_MODULE}:agentMessages`,
12
- patchThread: `${AGENT_MODULE}:agentPatchThread`,
13
- run: `${AGENT_MODULE}:agentRun`,
14
- setState: `${AGENT_MODULE}:agentSetState`,
15
- state: `${AGENT_MODULE}:agentState`
16
- };
17
- const toFunctionReference = (source) => {
18
- if (typeof source === "string") {
19
- return { __lunoraRef: source };
20
- }
21
- return source;
22
- };
23
-
24
- export { AGENT_MODULE, DEFAULT_AGENT_FUNCTION_PATHS, SANDBOX_INVOKE_PATH, SANDBOX_MODULE, toFunctionReference };