@arcforge/core 2.0.199 → 2.0.200

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": "@arcforge/core",
3
- "version": "2.0.199",
3
+ "version": "2.0.200",
4
4
  "type": "module",
5
5
  "main": "./src/index.ts",
6
6
  "exports": {
@@ -14,17 +14,17 @@
14
14
  "test:coverage": "bun test --coverage"
15
15
  },
16
16
  "dependencies": {
17
- "@arcforge/air": "2.0.199",
18
- "@arcforge/capsule": "2.0.199",
19
- "@arcforge/cloud": "2.0.199",
20
- "@arcforge/cognet": "2.0.199",
21
- "@arcforge/engines": "2.0.199",
22
- "@arcforge/err": "2.0.199",
23
- "@arcforge/kernel": "2.0.199",
24
- "@arcforge/link": "2.0.199",
25
- "@arcforge/session": "2.0.199",
26
- "@arcforge/types": "2.0.199",
27
- "@arcforge/vstr": "2.0.199",
17
+ "@arcforge/air": "2.0.200",
18
+ "@arcforge/capsule": "2.0.200",
19
+ "@arcforge/cloud": "2.0.200",
20
+ "@arcforge/cognet": "2.0.200",
21
+ "@arcforge/engines": "2.0.200",
22
+ "@arcforge/err": "2.0.200",
23
+ "@arcforge/kernel": "2.0.200",
24
+ "@arcforge/link": "2.0.200",
25
+ "@arcforge/session": "2.0.200",
26
+ "@arcforge/types": "2.0.200",
27
+ "@arcforge/vstr": "2.0.200",
28
28
  "crossws": "^0.3.5",
29
29
  "h3": "^1.13.0",
30
30
  "hookable": "^5.5.3",
@@ -99,11 +99,12 @@ function Invoke(opts: { kernel: AxonKernelT }) {
99
99
  // The surface travels with the message whether or not a shape was
100
100
  // asked for — it is the reply's address, not part of the contract.
101
101
  const channel = normalized.channel === undefined ? {} : { channel: normalized.channel }
102
- if (!normalized.output) return { content: normalized.prompt, ...channel }
102
+ if (!normalized.output) return { content: normalized.prompt, stimuli: normalized.stimuli, ...channel }
103
103
 
104
104
  const compiled = typechecker().compile(normalized.output)
105
105
  return {
106
106
  content: normalized.prompt,
107
+ stimuli: normalized.stimuli,
107
108
  ...channel,
108
109
  output: { declaration: compiled.declaration, check: compiled.check },
109
110
  ...(normalized.retries === undefined ? {} : { retries: normalized.retries }),
@@ -243,10 +243,18 @@ async function readInput(event: Parameters<typeof readBody>[0]): Promise<AxonReq
243
243
  const body = await readBody(event).catch(() => undefined)
244
244
 
245
245
  if (typeof body === "string") return { prompt: body }
246
- if (body && typeof body === "object" && "prompt" in body) {
247
- const prompt = (body as { prompt: unknown }).prompt
248
- if (typeof prompt === "string" || Array.isArray(prompt)) {
249
- return { prompt: prompt as string | string[] }
246
+ if (body && typeof body === "object") {
247
+ const value = body as { prompt?: unknown; stimuli?: unknown; channel?: unknown }
248
+ const prompt = typeof value.prompt === "string" || Array.isArray(value.prompt)
249
+ ? value.prompt as string | string[]
250
+ : undefined
251
+ const stimuli = Array.isArray(value.stimuli) ? value.stimuli : undefined
252
+ if (prompt !== undefined || stimuli !== undefined) {
253
+ return {
254
+ ...(prompt !== undefined ? { prompt } : {}),
255
+ ...(stimuli !== undefined ? { stimuli: stimuli as never } : {}),
256
+ ...(typeof value.channel === "string" ? { channel: value.channel } : {}),
257
+ }
250
258
  }
251
259
  }
252
260
 
@@ -50,11 +50,11 @@ export function Prompt(opts: PromptOpts) {
50
50
  * come through here instead of being installed into the agent.
51
51
  */
52
52
  async function renderEntry(entry: AxonPrompt, props?: Record<string, unknown>) {
53
- if (!entry.filePath) throw err("PROMPT_FILE_NOT_FOUND", { context: { path: entry.filePath ?? "" } })
53
+ if (!entry.filePath && !entry.source) throw err("PROMPT_FILE_NOT_FOUND", { context: { path: entry.filePath ?? "" } })
54
54
  const name = entry.name
55
55
 
56
56
  if (entry.kind === "static") {
57
- return await readFile(entry.filePath, "utf-8")
57
+ return entry.source ?? await readFile(entry.filePath!, "utf-8")
58
58
  }
59
59
 
60
60
  // vstr is a generic tool (no @axon/err dependency) — it throws a plain
@@ -62,15 +62,15 @@ export function Prompt(opts: PromptOpts) {
62
62
  // boundary, into the structured code so it renders as a proper AxonError
63
63
  // in chat instead of a raw string.
64
64
  try {
65
- return await (await loadVstr()).vstr(entry.filePath, {
65
+ const vstr = await loadVstr()
66
+ const options = {
66
67
  context: promptContext(),
67
- // Resolved at scan time and carried on the entry. Without
68
- // these, a prompt composing <Identity /> cannot resolve the
69
- // tag and the whole render throws — components are inlined
70
- // fragments, so a prompt that uses one is unrenderable
71
- // without them.
72
68
  ...(entry.components ? { components: entry.components } : {}),
73
- }).render(props)
69
+ }
70
+ const template = entry.source
71
+ ? vstr.vstr.source(entry.source, { ...options, filename: entry.filePath })
72
+ : vstr.vstr(entry.filePath!, options)
73
+ return await template.render(props)
74
74
  } catch (cause) {
75
75
  throw err("PROMPT_RENDER_FAILED", { cause, context: { name, path: entry.filePath } })
76
76
  }