oricore 1.5.0 → 1.5.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.
@@ -24817,6 +24817,7 @@ ${captureLines}` : capture.stack;
24817
24817
  });
24818
24818
 
24819
24819
  export {
24820
+ __require,
24820
24821
  __toESM,
24821
24822
  require_undici
24822
24823
  };
@@ -24828,4 +24829,4 @@ undici/lib/web/fetch/body.js:
24828
24829
  undici/lib/web/websocket/frame.js:
24829
24830
  (*! ws. MIT License. Einar Otto Stangvik <einaros@gmail.com> *)
24830
24831
  */
24831
- //# sourceMappingURL=chunk-DO76AL42.js.map
24832
+ //# sourceMappingURL=chunk-D5X6YFSK.js.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  __toESM,
3
3
  require_undici
4
- } from "./chunk-DO76AL42.js";
4
+ } from "./chunk-D5X6YFSK.js";
5
5
 
6
6
  // src/core/history.ts
7
7
  import createDebug7 from "debug";
@@ -2560,7 +2560,7 @@ function createProxyFetch(proxyUrl) {
2560
2560
  }
2561
2561
  return async (input, init) => {
2562
2562
  if (!undiciFetch) {
2563
- undiciFetch = (await import("./undici-326ZBRKH.js")).fetch;
2563
+ undiciFetch = (await import("./undici-NSB7IUB7.js")).fetch;
2564
2564
  }
2565
2565
  let url;
2566
2566
  let requestInit = init;
@@ -6991,72 +6991,10 @@ function readFileWithOffsetLimit(filePath, offset = 1, limit = MAX_LINES_TO_READ
6991
6991
 
6992
6992
  // src/tools/tools/skill.ts
6993
6993
  import path9 from "pathe";
6994
- import { z as z10 } from "zod";
6995
- function renderAvailableSkills(skills) {
6996
- return skills.map(
6997
- (skill) => `<skill>
6998
- <name>${skill.name}</name>
6999
- <description>${skill.description}</description>
7000
- </skill>`
7001
- ).join("\n");
7002
- }
7003
- function generateDescription(skillManager) {
7004
- const skills = skillManager.getSkills();
7005
- return `Execute a skill within the main conversation
7006
- <skills_instructions>
7007
- When users ask you to perform tasks, check if any of the available skills below match the task. If a skill matches, use this tool to invoke it. Skills provide specialized knowledge and procedures for specific tasks.
7008
- </skills_instructions>
7009
- <available_skills>
7010
- ${renderAvailableSkills(skills)}
7011
- </available_skills>`;
7012
- }
7013
- function createSkillTool(opts) {
7014
- return createTool({
7015
- name: "skill",
7016
- description: generateDescription(opts.skillManager),
7017
- parameters: z10.object({
7018
- skill: z10.string().describe("The skill name to execute")
7019
- }),
7020
- getDescription: ({ params }) => {
7021
- return params.skill;
7022
- },
7023
- async execute({ skill }) {
7024
- const trimmed = skill.trim();
7025
- const skillName = trimmed.startsWith("/") ? trimmed.substring(1) : trimmed;
7026
- const foundSkill = opts.skillManager.getSkill(skillName);
7027
- if (!foundSkill) {
7028
- return {
7029
- isError: true,
7030
- llmContent: `Skill "${skillName}" not found`
7031
- };
7032
- }
7033
- const body = await opts.skillManager.readSkillBody(foundSkill);
7034
- const baseDir = path9.dirname(foundSkill.path);
7035
- const messages = [
7036
- {
7037
- type: "text",
7038
- text: `<command-message>${skillName} is running\u2026</command-message>
7039
- <command-name>${skillName}</command-name>`
7040
- },
7041
- {
7042
- type: "text",
7043
- text: `Base directory for this skill: ${baseDir}
7044
-
7045
- ${body}`,
7046
- isMeta: true
7047
- }
7048
- ];
7049
- return {
7050
- llmContent: safeStringify(messages),
7051
- returnDisplay: `Loaded skill: ${foundSkill.name}`
7052
- };
7053
- },
7054
- approval: { category: "read" }
7055
- });
7056
- }
6994
+ import { z as z11 } from "zod";
7057
6995
 
7058
6996
  // src/tools/tools/task.ts
7059
- import { z as z11 } from "zod";
6997
+ import { z as z10 } from "zod";
7060
6998
  function createTaskTool(opts) {
7061
6999
  const { signal, sessionId } = opts;
7062
7000
  const { cwd, agentManager, messageBus } = opts.context;
@@ -7122,11 +7060,11 @@ Since the user is greeting, use the greeting-responder agent to respond with a f
7122
7060
  assistant: "I'm going to use the ${"task" /* TASK */} tool to launch the with the greeting-responder agent"
7123
7061
  </example>
7124
7062
  `,
7125
- parameters: z11.object({
7126
- description: z11.string().describe("A short (3-5 word) description of task"),
7127
- prompt: z11.string().describe("The task for the agent to perform"),
7128
- subagent_type: z11.string().describe("The type of specialized agent to use for this task"),
7129
- resume: z11.string().optional().describe(
7063
+ parameters: z10.object({
7064
+ description: z10.string().describe("A short (3-5 word) description of task"),
7065
+ prompt: z10.string().describe("The task for the agent to perform"),
7066
+ subagent_type: z10.string().describe("The type of specialized agent to use for this task"),
7067
+ resume: z10.string().optional().describe(
7130
7068
  "Optional agent ID to resume from. If provided, the agent will continue from the previous execution transcript."
7131
7069
  )
7132
7070
  }),
@@ -7298,6 +7236,112 @@ Agent ID: ${result.agentId}`,
7298
7236
  });
7299
7237
  }
7300
7238
 
7239
+ // src/tools/tools/skill.ts
7240
+ function renderAvailableSkills(skills) {
7241
+ return skills.filter((skill) => skill.modelInvocable !== false).map(
7242
+ (skill) => `<skill>
7243
+ <name>${skill.name}</name>
7244
+ <description>${skill.description}</description>
7245
+ </skill>`
7246
+ ).join("\n");
7247
+ }
7248
+ function generateDescription(skillManager) {
7249
+ const skills = skillManager.getSkills({ modelInvocable: true });
7250
+ return `Execute a skill within the main conversation
7251
+ <skills_instructions>
7252
+ When users ask you to perform tasks, check if any of the available skills below match the task. If a skill matches, use this tool to invoke it. Skills provide specialized knowledge and procedures for specific tasks.
7253
+ </skills_instructions>
7254
+ <available_skills>
7255
+ ${renderAvailableSkills(skills)}
7256
+ </available_skills>`;
7257
+ }
7258
+ function createSkillTool(opts) {
7259
+ const { skillManager, context, tools, sessionId, signal } = opts;
7260
+ return createTool({
7261
+ name: "skill",
7262
+ description: generateDescription(skillManager),
7263
+ parameters: z11.object({
7264
+ skill: z11.string().describe("The skill name to execute"),
7265
+ args: z11.string().optional().describe("Optional arguments to pass to the skill")
7266
+ }),
7267
+ getDescription: ({ params }) => {
7268
+ return params.args ? `${params.skill} ${params.args}` : params.skill;
7269
+ },
7270
+ async execute({ skill, args }) {
7271
+ const trimmed = skill.trim();
7272
+ const skillName = trimmed.startsWith("/") ? trimmed.substring(1) : trimmed;
7273
+ const foundSkill = skillManager.getSkill(skillName);
7274
+ if (!foundSkill) {
7275
+ return {
7276
+ isError: true,
7277
+ llmContent: `Skill "${skillName}" not found`
7278
+ };
7279
+ }
7280
+ if (foundSkill.modelInvocable === false) {
7281
+ return {
7282
+ isError: true,
7283
+ llmContent: `Skill "${skillName}" cannot be invoked by the model`
7284
+ };
7285
+ }
7286
+ const skillArgs = args || "";
7287
+ const body = await skillManager.readSkillBody(foundSkill, skillArgs);
7288
+ const baseDir = path9.dirname(foundSkill.path);
7289
+ if (foundSkill.context === "fork") {
7290
+ if (!context.agentManager) {
7291
+ return {
7292
+ isError: true,
7293
+ llmContent: `Skill "${skillName}" requires fork execution but agent manager is not available`
7294
+ };
7295
+ }
7296
+ const allowedTools = foundSkill.allowedTools;
7297
+ const filteredTools = allowedTools ? tools.filter(
7298
+ (t) => t.name !== "skill" && allowedTools.some(
7299
+ (allowed) => allowed.toLowerCase() === t.name.toLowerCase()
7300
+ )
7301
+ ) : tools.filter((t) => t.name !== "skill");
7302
+ const taskTool = createTaskTool({
7303
+ context,
7304
+ tools: filteredTools,
7305
+ sessionId,
7306
+ signal
7307
+ });
7308
+ const agentType = foundSkill.agent || "general-purpose";
7309
+ const prompt = `Base directory for this skill: ${baseDir}
7310
+
7311
+ ${body}`;
7312
+ const toolCallId = `skill-${skillName}-${randomUUID()}`;
7313
+ return taskTool.execute(
7314
+ {
7315
+ description: `Execute skill: ${skillName}`,
7316
+ prompt,
7317
+ subagent_type: agentType
7318
+ },
7319
+ toolCallId
7320
+ );
7321
+ }
7322
+ const messages = [
7323
+ {
7324
+ type: "text",
7325
+ text: `<command-message>${skillName} is running\u2026</command-message>
7326
+ <command-name>${skillName}</command-name>`
7327
+ },
7328
+ {
7329
+ type: "text",
7330
+ text: `Base directory for this skill: ${baseDir}
7331
+
7332
+ ${body}`,
7333
+ isMeta: true
7334
+ }
7335
+ ];
7336
+ return {
7337
+ llmContent: safeStringify(messages),
7338
+ returnDisplay: `Loaded skill: ${foundSkill.name}`
7339
+ };
7340
+ },
7341
+ approval: { category: "read" }
7342
+ });
7343
+ }
7344
+
7301
7345
  // src/tools/tools/todo.ts
7302
7346
  import fs10 from "fs";
7303
7347
  import { readFile, writeFile } from "fs/promises";
@@ -7624,8 +7668,7 @@ async function resolveTools(opts) {
7624
7668
  createLSTool({ cwd }),
7625
7669
  createGlobTool({ cwd }),
7626
7670
  createGrepTool({ cwd }),
7627
- createFetchTool({ model, fetch: opts.context.fetch }),
7628
- ...hasSkills ? [createSkillTool({ skillManager: opts.context.skillManager })] : []
7671
+ createFetchTool({ model, fetch: opts.context.fetch })
7629
7672
  ];
7630
7673
  const askUserQuestionTools = opts.askUserQuestion ? [createAskUserQuestionTool()] : [];
7631
7674
  const writeTools = opts.write ? [
@@ -7653,7 +7696,7 @@ async function resolveTools(opts) {
7653
7696
  })
7654
7697
  ] : [];
7655
7698
  const mcpTools = await getMcpTools(opts.context);
7656
- const allTools = [
7699
+ let allTools = [
7657
7700
  ...readonlyTools,
7658
7701
  ...askUserQuestionTools,
7659
7702
  ...writeTools,
@@ -7661,6 +7704,16 @@ async function resolveTools(opts) {
7661
7704
  ...backgroundTools,
7662
7705
  ...mcpTools
7663
7706
  ];
7707
+ if (hasSkills) {
7708
+ const skillTool = createSkillTool({
7709
+ skillManager: opts.context.skillManager,
7710
+ context: opts.context,
7711
+ tools: allTools,
7712
+ sessionId: opts.sessionId,
7713
+ signal: opts.signal
7714
+ });
7715
+ allTools = [...allTools, skillTool];
7716
+ }
7664
7717
  let availableTools = allTools;
7665
7718
  try {
7666
7719
  availableTools = await opts.context.apply({
@@ -8498,4 +8551,4 @@ export {
8498
8551
  Tools,
8499
8552
  createLSTool
8500
8553
  };
8501
- //# sourceMappingURL=chunk-4QYFQSAC.js.map
8554
+ //# sourceMappingURL=chunk-MZNH54NB.js.map