veryfront 0.1.1091 → 0.1.1093

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.
@@ -1 +1 @@
1
- {"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/schedule/handler.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AA4BxD,wBAAsB,qBAAqB,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAwC3E"}
1
+ {"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/schedule/handler.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AA4BxD,wBAAsB,qBAAqB,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAwE3E"}
@@ -33,6 +33,31 @@ export async function handleScheduleCommand(args) {
33
33
  if (!schedule) {
34
34
  throw new Error(`Schedule "${opts.id}" not found.`);
35
35
  }
36
+ const triggerInput = input ?? schedule.input ?? {};
37
+ const scheduleConfig = triggerInput && typeof triggerInput === "object" && !Array.isArray(triggerInput)
38
+ ? triggerInput
39
+ : {};
40
+ const scheduleName = schedule.name ?? schedule.id;
41
+ const scheduleTarget = scheduleConfig._schedule_target;
42
+ const conversationMode = scheduleTarget && typeof scheduleTarget === "object" &&
43
+ !Array.isArray(scheduleTarget)
44
+ ? scheduleTarget.conversationMode
45
+ : undefined;
46
+ if (schedule.target.kind === "agent" && conversationMode === "existing") {
47
+ throw new Error("Local scheduled agent runs cannot attach to an existing cloud conversation.");
48
+ }
49
+ const agentRunOptions = schedule.target.kind === "agent"
50
+ ? {
51
+ agentInput: typeof scheduleConfig.prompt === "string" && scheduleConfig.prompt.trim().length > 0
52
+ ? scheduleConfig.prompt
53
+ : `Run scheduled agent ${schedule.target.id} for ${scheduleName}`,
54
+ agentContext: {
55
+ trigger: "schedule",
56
+ schedule: { id: schedule.id, name: scheduleName },
57
+ forwardedProps: scheduleConfig,
58
+ },
59
+ }
60
+ : {};
36
61
  const run = await runTriggerTarget({
37
62
  projectDir,
38
63
  adapter,
@@ -40,7 +65,8 @@ export async function handleScheduleCommand(args) {
40
65
  cacheKey: configCacheKey,
41
66
  projectId,
42
67
  target: schedule.target,
43
- input: input ?? schedule.input ?? {},
68
+ input: triggerInput,
69
+ ...agentRunOptions,
44
70
  debug: opts.debug,
45
71
  });
46
72
  await outputTriggerRun({
package/esm/deno.js CHANGED
@@ -1,6 +1,6 @@
1
1
  export default {
2
2
  "name": "veryfront",
3
- "version": "0.1.1091",
3
+ "version": "0.1.1093",
4
4
  "license": "Apache-2.0",
5
5
  "nodeModulesDir": "auto",
6
6
  "minimumDependencyAge": {
@@ -1 +1 @@
1
- {"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../src/src/schedule/factory.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAEV,cAAc,EACd,kBAAkB,EAInB,MAAM,YAAY,CAAC;AA8LpB,wBAAgB,QAAQ,CAAC,MAAM,EAAE,cAAc,GAAG,kBAAkB,CA4CnE"}
1
+ {"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../src/src/schedule/factory.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAEV,cAAc,EACd,kBAAkB,EAKnB,MAAM,YAAY,CAAC;AAmNpB,wBAAgB,QAAQ,CAAC,MAAM,EAAE,cAAc,GAAG,kBAAkB,CA8CnE"}
@@ -13,9 +13,13 @@ function requireString(value, label) {
13
13
  function validatePositiveInteger(value, label) {
14
14
  if (value === undefined)
15
15
  return;
16
- if (!Number.isInteger(value) || Number(value) <= 0) {
16
+ requirePositiveInteger(value, label);
17
+ }
18
+ function requirePositiveInteger(value, label) {
19
+ if (typeof value !== "number" || !Number.isInteger(value) || value <= 0) {
17
20
  throw SCHEDULE_CONFIG_INVALID.create({ detail: `${label} must be a positive integer.` });
18
21
  }
22
+ return value;
19
23
  }
20
24
  function requireContractString(value, label, maxLength) {
21
25
  const normalized = requireString(value, label).trim();
@@ -45,6 +49,18 @@ function assertOnlyKeys(record, allowedKeys, label) {
45
49
  throw new Error(`${label}.${unknownKey} is not supported.`);
46
50
  }
47
51
  }
52
+ function normalizeScheduleHealth(value) {
53
+ if (value === undefined)
54
+ return undefined;
55
+ if (!value || typeof value !== "object" || Array.isArray(value)) {
56
+ throw SCHEDULE_CONFIG_INVALID.create({ detail: "Schedule health must be an object." });
57
+ }
58
+ const record = value;
59
+ assertOnlyKeys(record, ["maxStalenessSeconds"], "Schedule health");
60
+ return {
61
+ maxStalenessSeconds: requirePositiveInteger(record.maxStalenessSeconds, "Schedule health.maxStalenessSeconds"),
62
+ };
63
+ }
48
64
  function normalizeIntegrationRequirements(value) {
49
65
  if (value === undefined)
50
66
  return undefined;
@@ -138,6 +154,7 @@ export function schedule(config) {
138
154
  validatePositiveInteger(config.backoffLimit, "Schedule backoffLimit");
139
155
  validatePositiveInteger(config.maxRuns, "Schedule maxRuns");
140
156
  assertSerializable(config.input, "Schedule input");
157
+ const health = normalizeScheduleHealth(config.health);
141
158
  const integrationRequirements = normalizeIntegrationRequirements(config.integrationRequirements);
142
159
  return {
143
160
  id,
@@ -153,6 +170,7 @@ export function schedule(config) {
153
170
  ? {}
154
171
  : { concurrencyPolicy: config.concurrencyPolicy }),
155
172
  ...(config.maxRuns === undefined ? {} : { maxRuns: config.maxRuns }),
173
+ ...(health === undefined ? {} : { health }),
156
174
  ...(integrationRequirements === undefined ? {} : { integrationRequirements }),
157
175
  };
158
176
  }
@@ -13,12 +13,13 @@
13
13
  * timezone: "Europe/Stockholm",
14
14
  * target: { kind: "workflow", id: "escalate-ticket" },
15
15
  * input: { severity: "high" },
16
+ * health: { maxStalenessSeconds: 1800 },
16
17
  * });
17
18
  * ```
18
19
  */
19
20
  import "../../_dnt.polyfills.js";
20
21
  export { schedule } from "./factory.js";
21
- export type { ScheduleConcurrencyPolicy, ScheduleConfig, ScheduleDefinition, ScheduleIntegrationRequirement, ScheduleIntegrationRequirementConfig, ScheduleIntegrationResource, ScheduleIntegrationResourceIdentity, } from "./types.js";
22
+ export type { ScheduleConcurrencyPolicy, ScheduleConfig, ScheduleDefinition, ScheduleHealth, ScheduleIntegrationRequirement, ScheduleIntegrationRequirementConfig, ScheduleIntegrationResource, ScheduleIntegrationResourceIdentity, } from "./types.js";
22
23
  export { isScheduleDefinition } from "./types.js";
23
24
  export { discoverSchedules } from "./discovery.js";
24
25
  export type { ScheduleDiscoveryOptions, ScheduleDiscoveryResult } from "./discovery.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/src/schedule/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,yBAAyB,CAAC;AAGjC,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,YAAY,EACV,yBAAyB,EACzB,cAAc,EACd,kBAAkB,EAClB,8BAA8B,EAC9B,oCAAoC,EACpC,2BAA2B,EAC3B,mCAAmC,GACpC,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,YAAY,EAAE,wBAAwB,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/src/schedule/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,yBAAyB,CAAC;AAGjC,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,YAAY,EACV,yBAAyB,EACzB,cAAc,EACd,kBAAkB,EAClB,cAAc,EACd,8BAA8B,EAC9B,oCAAoC,EACpC,2BAA2B,EAC3B,mCAAmC,GACpC,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,YAAY,EAAE,wBAAwB,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC"}
@@ -13,6 +13,7 @@
13
13
  * timezone: "Europe/Stockholm",
14
14
  * target: { kind: "workflow", id: "escalate-ticket" },
15
15
  * input: { severity: "high" },
16
+ * health: { maxStalenessSeconds: 1800 },
16
17
  * });
17
18
  * ```
18
19
  */
@@ -1,5 +1,9 @@
1
1
  import type { TriggerTarget } from "../trigger/target.js";
2
2
  export type ScheduleConcurrencyPolicy = "Allow" | "Forbid" | "Replace";
3
+ /** Marks a schedule unhealthy when it has not succeeded within the given budget. */
4
+ export interface ScheduleHealth {
5
+ maxStalenessSeconds: number;
6
+ }
3
7
  export interface ScheduleIntegrationResourceIdentity {
4
8
  kind: string;
5
9
  id: string;
@@ -29,6 +33,7 @@ export interface ScheduleDefinition {
29
33
  backoffLimit?: number;
30
34
  concurrencyPolicy?: ScheduleConcurrencyPolicy;
31
35
  maxRuns?: number;
36
+ health?: ScheduleHealth;
32
37
  integrationRequirements?: ScheduleIntegrationRequirement[];
33
38
  }
34
39
  export type ScheduleConfig = Omit<ScheduleDefinition, "schedule" | "integrationRequirements"> & {
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/src/schedule/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAE1D,MAAM,MAAM,yBAAyB,GAAG,OAAO,GAAG,QAAQ,GAAG,SAAS,CAAC;AAEvE,MAAM,WAAW,mCAAmC;IAClD,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,MAAM,WAAW,2BAA4B,SAAQ,mCAAmC;IACtF,MAAM,CAAC,EAAE,mCAAmC,CAAC;CAC9C;AAED,MAAM,WAAW,8BAA8B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C;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,uBAAuB,CAAC,EAAE,oCAAoC,EAAE,CAAC;CAClE,CAAC;AAEF,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,kBAAkB,CAWhF"}
@@ -6,8 +6,20 @@ export function isScheduleDefinition(value) {
6
6
  typeof definition.schedule === "string" &&
7
7
  definition.target !== null &&
8
8
  typeof definition.target === "object" &&
9
+ isScheduleHealth(definition.health) &&
9
10
  isScheduleIntegrationRequirements(definition.integrationRequirements));
10
11
  }
12
+ function isScheduleHealth(value) {
13
+ if (value === undefined)
14
+ return true;
15
+ if (!value || typeof value !== "object" || Array.isArray(value))
16
+ return false;
17
+ const record = value;
18
+ return hasOnlyKeys(record, ["maxStalenessSeconds"]) &&
19
+ typeof record.maxStalenessSeconds === "number" &&
20
+ Number.isInteger(record.maxStalenessSeconds) &&
21
+ record.maxStalenessSeconds > 0;
22
+ }
11
23
  function isScheduleIntegrationRequirements(value) {
12
24
  if (value === undefined)
13
25
  return true;
@@ -6,7 +6,8 @@
6
6
  /**
7
7
  * Fetch environment variables for a project from the Veryfront API.
8
8
  *
9
- * Calls: GET {apiBaseUrl}/projects/{projectSlug}/environment-variables?environment_id={environmentId}&limit=100
9
+ * Hosted runtimes call the internal Basic-auth endpoint first. Older API deployments
10
+ * without that endpoint fall back to the bearer-auth management endpoint.
10
11
  * Response: { data: [{ key: string, value: string }] }
11
12
  */
12
13
  export declare function fetchProjectEnvVars(apiBaseUrl: string, projectSlug: string, environmentId: string, token: string): Promise<Record<string, string>>;
@@ -1 +1 @@
1
- {"version":3,"file":"fetcher.d.ts","sourceRoot":"","sources":["../../../../src/src/server/project-env/fetcher.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAYH;;;;;GAKG;AACH,wBAAsB,mBAAmB,CACvC,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,MAAM,EACnB,aAAa,EAAE,MAAM,EACrB,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAgEjC"}
1
+ {"version":3,"file":"fetcher.d.ts","sourceRoot":"","sources":["../../../../src/src/server/project-env/fetcher.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAgDH;;;;;;GAMG;AACH,wBAAsB,mBAAmB,CACvC,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,MAAM,EACnB,aAAa,EAAE,MAAM,EACrB,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CA2EjC"}
@@ -5,25 +5,24 @@
5
5
  */
6
6
  import { getBaseLogger } from "../../utils/index.js";
7
7
  import { NETWORK_ERROR } from "../../errors/index.js";
8
+ import { getHostEnv } from "../../platform/compat/process.js";
8
9
  const baseLogger = getBaseLogger("PROJECT-ENV");
9
10
  const logger = baseLogger.component("project-env");
10
11
  /** Max env vars per request. API enforces a hard cap of 100. */
11
12
  const ENV_VARS_FETCH_LIMIT = 100;
12
- /**
13
- * Fetch environment variables for a project from the Veryfront API.
14
- *
15
- * Calls: GET {apiBaseUrl}/projects/{projectSlug}/environment-variables?environment_id={environmentId}&limit=100
16
- * Response: { data: [{ key: string, value: string }] }
17
- */
18
- export async function fetchProjectEnvVars(apiBaseUrl, projectSlug, environmentId, token) {
19
- const url = `${apiBaseUrl}/projects/${encodeURIComponent(projectSlug)}/environment-variables?environment_id=${encodeURIComponent(environmentId)}&limit=${ENV_VARS_FETCH_LIMIT}`;
20
- // Separate try-catch blocks eliminate the need to re-detect "our own" thrown errors
21
- // by message string matching. Each catch handles a distinct failure mode.
22
- let response;
13
+ const MASKED_ENV_VALUE = "********";
14
+ function getInternalAuthorization() {
15
+ const username = getHostEnv("VERYFRONT_API_INTERNAL_USER");
16
+ const password = getHostEnv("VERYFRONT_API_INTERNAL_PASS");
17
+ if (!username || !password)
18
+ return undefined;
19
+ return `Basic ${globalThis.btoa(`${username}:${password}`)}`;
20
+ }
21
+ async function fetchEnvironmentVariables(url, authorization, projectSlug, environmentId) {
23
22
  try {
24
- response = await fetch(url, {
23
+ return await fetch(url, {
25
24
  headers: {
26
- Authorization: `Bearer ${token}`,
25
+ Authorization: authorization,
27
26
  Accept: "application/json",
28
27
  },
29
28
  });
@@ -36,6 +35,25 @@ export async function fetchProjectEnvVars(apiBaseUrl, projectSlug, environmentId
36
35
  });
37
36
  throw error;
38
37
  }
38
+ }
39
+ /**
40
+ * Fetch environment variables for a project from the Veryfront API.
41
+ *
42
+ * Hosted runtimes call the internal Basic-auth endpoint first. Older API deployments
43
+ * without that endpoint fall back to the bearer-auth management endpoint.
44
+ * Response: { data: [{ key: string, value: string }] }
45
+ */
46
+ export async function fetchProjectEnvVars(apiBaseUrl, projectSlug, environmentId, token) {
47
+ const managementUrl = `${apiBaseUrl}/projects/${encodeURIComponent(projectSlug)}/environment-variables?environment_id=${encodeURIComponent(environmentId)}&limit=${ENV_VARS_FETCH_LIMIT}`;
48
+ const internalUrl = `${apiBaseUrl}/internal/project-environment-variables?environment_id=${encodeURIComponent(environmentId)}`;
49
+ const internalAuthorization = getInternalAuthorization();
50
+ let response = internalAuthorization
51
+ ? await fetchEnvironmentVariables(internalUrl, internalAuthorization, projectSlug, environmentId)
52
+ : await fetchEnvironmentVariables(managementUrl, `Bearer ${token}`, projectSlug, environmentId);
53
+ if (internalAuthorization && response.status === 404) {
54
+ await response.body?.cancel();
55
+ response = await fetchEnvironmentVariables(managementUrl, `Bearer ${token}`, projectSlug, environmentId);
56
+ }
39
57
  if (!response.ok) {
40
58
  await response.body?.cancel();
41
59
  logger.warn("Failed to fetch env vars", {
@@ -50,6 +68,11 @@ export async function fetchProjectEnvVars(apiBaseUrl, projectSlug, environmentId
50
68
  const result = {};
51
69
  if (body.data) {
52
70
  for (const entry of body.data) {
71
+ if (entry.value === MASKED_ENV_VALUE) {
72
+ throw NETWORK_ERROR.create({
73
+ detail: "Refusing masked environment variable response",
74
+ });
75
+ }
53
76
  result[entry.key] = entry.value;
54
77
  }
55
78
  }
@@ -9,6 +9,7 @@
9
9
  * @module
10
10
  */
11
11
  import type { Tool } from "../tool/index.js";
12
+ import type { SkillScriptExecutor } from "./types.js";
12
13
  /**
13
14
  * Create the load_skill tool.
14
15
  * Loads a skill's full instructions, available references, and scripts.
@@ -23,5 +24,7 @@ export declare function createLoadSkillReferenceTool(): Tool;
23
24
  * Create the execute_skill_script tool.
24
25
  * Executes a script from a skill's scripts/ directory.
25
26
  */
26
- export declare function createExecuteSkillScriptTool(): Tool;
27
+ export declare function createExecuteSkillScriptTool(options?: {
28
+ executor?: SkillScriptExecutor;
29
+ }): Tool;
27
30
  //# sourceMappingURL=tools.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../../src/src/skill/tools.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,OAAO,KAAK,EAAE,IAAI,EAAwB,MAAM,kBAAkB,CAAC;AAmJnE;;;GAGG;AACH,wBAAgB,mBAAmB,IAAI,IAAI,CAkD1C;AAED;;;GAGG;AACH,wBAAgB,4BAA4B,IAAI,IAAI,CA+BnD;AAED;;;GAGG;AACH,wBAAgB,4BAA4B,IAAI,IAAI,CAuCnD"}
1
+ {"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../../src/src/skill/tools.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,OAAO,KAAK,EAAE,IAAI,EAAwB,MAAM,kBAAkB,CAAC;AAQnE,OAAO,KAAK,EAAuB,mBAAmB,EAAE,MAAM,YAAY,CAAC;AA2I3E;;;GAGG;AACH,wBAAgB,mBAAmB,IAAI,IAAI,CAkD1C;AAED;;;GAGG;AACH,wBAAgB,4BAA4B,IAAI,IAAI,CA+BnD;AAED;;;GAGG;AACH,wBAAgB,4BAA4B,CAC1C,OAAO,GAAE;IAAE,QAAQ,CAAC,EAAE,mBAAmB,CAAA;CAAO,GAC/C,IAAI,CAuCN"}
@@ -169,7 +169,7 @@ export function createLoadSkillReferenceTool() {
169
169
  * Create the execute_skill_script tool.
170
170
  * Executes a script from a skill's scripts/ directory.
171
171
  */
172
- export function createExecuteSkillScriptTool() {
172
+ export function createExecuteSkillScriptTool(options = {}) {
173
173
  return tool({
174
174
  id: "execute_skill_script",
175
175
  description: "Execute a script from a skill's scripts/ directory. Returns stdout, stderr, and exit code.",
@@ -186,7 +186,7 @@ export function createExecuteSkillScriptTool() {
186
186
  // Validate path safety (only scripts/ allowed)
187
187
  const validatedPath = await validateSkillPath(skill.rootPath, input.script, [SKILL_SCRIPTS_DIR], skill.fsAdapter);
188
188
  const scriptContent = await readSkillFile(skill, validatedPath);
189
- const executor = getSkillScriptExecutor();
189
+ const executor = options.executor ?? getSkillScriptExecutor();
190
190
  return await executor.execute({
191
191
  scriptPath: validatedPath,
192
192
  scriptContent,
@@ -9,6 +9,8 @@ export interface RunTriggerTargetOptions {
9
9
  projectId?: string;
10
10
  target: TriggerTarget;
11
11
  input?: unknown;
12
+ agentInput?: string;
13
+ agentContext?: Record<string, unknown>;
12
14
  debug?: boolean;
13
15
  }
14
16
  export interface TriggerTargetRunResult {
@@ -1 +1 @@
1
- {"version":3,"file":"local-runner.d.ts","sourceRoot":"","sources":["../../../src/src/trigger/local-runner.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAQ1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjD,MAAM,WAAW,uBAAuB;IACtC,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,cAAc,CAAC;IACxB,MAAM,CAAC,EAAE,eAAe,CAAC;IACzB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,aAAa,CAAC;IACtB,KAAK,C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,CAAC,sBAAsB,CAAC,CAUjC"}
@@ -88,6 +88,45 @@ async function runWorkflowTarget(options) {
88
88
  }
89
89
  });
90
90
  }
91
+ async function runAgentTarget(options) {
92
+ const agentInput = options.agentInput;
93
+ if (agentInput === undefined) {
94
+ throw TRIGGER_NOT_SUPPORTED.create({
95
+ detail: "Local agent trigger runs require an explicit agent input.",
96
+ });
97
+ }
98
+ const start = Date.now();
99
+ const discovery = await discoverRuntimeOrThrow(options);
100
+ const agent = agentRegistry.get(options.target.id);
101
+ if (!agent) {
102
+ throw TRIGGER_TARGET_NOT_FOUND.create({
103
+ detail: `Agent target "${options.target.id}" not found.`,
104
+ context: { targetId: options.target.id },
105
+ });
106
+ }
107
+ return await runWithProjectAgentRuntime(discovery, async () => {
108
+ const response = await agent.generate({
109
+ input: agentInput,
110
+ ...(options.agentContext === undefined ? {} : { context: options.agentContext }),
111
+ });
112
+ if (response.status === "error") {
113
+ throw TRIGGER_EXECUTION_FAILED.create({
114
+ detail: `Agent target "${options.target.id}" failed.`,
115
+ context: { targetId: options.target.id },
116
+ });
117
+ }
118
+ return {
119
+ kind: "agent",
120
+ id: options.target.id,
121
+ output: {
122
+ text: response.text,
123
+ status: response.status,
124
+ toolCalls: response.toolCalls.length,
125
+ },
126
+ durationMs: Date.now() - start,
127
+ };
128
+ });
129
+ }
91
130
  export async function runTriggerTarget(options) {
92
131
  if (options.target.kind === "task") {
93
132
  return await runTaskTarget(options);
@@ -95,7 +134,5 @@ export async function runTriggerTarget(options) {
95
134
  if (options.target.kind === "workflow") {
96
135
  return await runWorkflowTarget(options);
97
136
  }
98
- throw TRIGGER_NOT_SUPPORTED.create({
99
- detail: "Agent trigger targets are Cloud-only for this milestone. Use a workflow or task for local trigger runs.",
100
- });
137
+ return await runAgentTarget(options);
101
138
  }
@@ -1,3 +1,3 @@
1
1
  /** Shared version value. */
2
- export declare const VERSION = "0.1.1091";
2
+ export declare const VERSION = "0.1.1093";
3
3
  //# sourceMappingURL=version-constant.d.ts.map
@@ -1,4 +1,4 @@
1
1
  // Keep in sync with deno.json version.
2
2
  // scripts/release.ts updates this constant during releases.
3
3
  /** Shared version value. */
4
- export const VERSION = "0.1.1091";
4
+ export const VERSION = "0.1.1093";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "veryfront",
3
- "version": "0.1.1091",
3
+ "version": "0.1.1093",
4
4
  "description": "The simplest way to build AI-powered apps",
5
5
  "keywords": [
6
6
  "react",
@@ -328,10 +328,10 @@
328
328
  "@types/react": "19.2.14",
329
329
  "@types/react-dom": "19.2.3",
330
330
  "ws": "8.21.0",
331
- "@veryfront/ext-bundler-esbuild": "0.1.1091",
332
- "@veryfront/ext-content-mdx": "0.1.1091",
333
- "@veryfront/ext-css-tailwind": "0.1.1091",
334
- "@veryfront/ext-parser-babel": "0.1.1091"
331
+ "@veryfront/ext-bundler-esbuild": "0.1.1093",
332
+ "@veryfront/ext-content-mdx": "0.1.1093",
333
+ "@veryfront/ext-css-tailwind": "0.1.1093",
334
+ "@veryfront/ext-parser-babel": "0.1.1093"
335
335
  },
336
336
  "devDependencies": {
337
337
  "@types/node": "20.9.0"