Skip to content

armgit / Orkas

Public Imported from GitHub
0

Orkas is an open-source (MIT), local-first AI team for your desktop: a Commander turns your goal into to-dos and coordinates 16 built-in specialist agents plus Claude Code, Codex, OpenCode, OpenClaw and Hermes, with projects, scheduled automations and connectors. Free app for macOS & Windows; built-in models or your own keys.

Merge origin/main into sync branch

wyt4b907aba71ec
diff --cc src/core-agent/test/process-session.test.ts
index 55da8601,40ccd2cc..66694575
--- a/src/core-agent/test/process-session.test.ts
+++ b/src/core-agent/test/process-session.test.ts
@@@ -173,12 -91,12 +173,11 @@@ describe("persistent process sessions"
await expect(fs.stat(marker)).rejects.toMatchObject({ code: "ENOENT" });
});
- it("advertises action requirements and rejects fields from another lifecycle action", async () => {
+ it("uses a portable schema and ignores startup fields on reads", async () => {
const processSession = tool("process_session");
const schema = processSession.inputSchema as any;
- expect(schema.required).toEqual(["action"]);
- expect(schema).not.toHaveProperty("oneOf");
--
+ expect(schema.oneOf).toBeUndefined();
+ expect(schema.required).toEqual(["action", "session_id"]);
const rejected = await processSession.execute({
action: "read",
session_id: "proc-missing",
diff --cc src/core-agent/test/project-tasks-tool.test.ts
index bd12e741,d88febcc..da052281
--- a/src/core-agent/test/project-tasks-tool.test.ts
+++ b/src/core-agent/test/project-tasks-tool.test.ts
@@@ -60,7 -60,8 +60,8 @@@ describe('todo_tasks tool', () =>
const tool = createProjectTasksTool(handler);
const schema = tool.inputSchema as any;
expect(schema.additionalProperties).toBe(false);
- expect(schema).not.toHaveProperty('oneOf');
+ expect(schema.oneOf).toBeUndefined();
+ expect(schema.required).toEqual(['action']);
expect(schema.properties.action.description).toContain('Omit unrelated fields');
const result = await tool.execute({ action: 'complete', task_id: 't_9', status: 'done' }, ctx);
diff --cc src/main/model/core-agent/tool-result-tools.ts
index 1043e61a,b584d654..8187102d
--- a/src/main/model/core-agent/tool-result-tools.ts
+++ b/src/main/model/core-agent/tool-result-tools.ts
@@@ -340,8 -367,25 +340,8 @@@ function createToolResultTool(opts: Too
const actionProperty = {
type: 'string',
enum: ['search', 'query', 'read', 'materialize'],
- description: 'search: narrow text lookup; query: deterministic aggregates; read: exact source excerpts; materialize: session-scoped UTF-8 copies for calculations query cannot express. Use one operation per call.',
+ description: 'search: narrow text lookup; query: deterministic aggregates; read: exact source excerpts; materialize: session-scoped UTF-8 copies for full-data calculations that query cannot express. Use one operation per call.',
};
- // Conditional requirements and incompatible fields remain enforced by the
- // selected action's executor. Keep one portable closed object for provider
- // admission instead of nested union composition.
- const requestSchema = {
- type: 'object',
- additionalProperties: false,
- properties: {
- ...structuredRequest.properties,
- query: searchRequest.properties.query,
- match: textCountRequest.properties.match,
- count_unit: textCountRequest.properties.count_unit,
- cursor: readRequest.properties.cursor,
- max_tokens: readRequest.properties.max_tokens,
- },
- required: ['ref'],
- description: 'Use only fields for the selected action. materialize takes ref only.',
- };
return {
name: 'tool_result',
description:
diff --cc test/main/model/core-agent/chat-history-tools.test.ts
index e9392a72,919704f3..bbb49154
--- a/test/main/model/core-agent/chat-history-tools.test.ts
+++ b/test/main/model/core-agent/chat-history-tools.test.ts
@@@ -752,10 -674,11 +752,11 @@@ describe('chat-history-tools › shape'
expect(schema.properties.scope.enum).toEqual(['current', 'all']);
expect(chatHistory.inputSchema.required).toEqual(['action']);
expect(JSON.stringify(chatHistory.inputSchema)).not.toMatch(/project/i);
+ expect(schema.oneOf).toBeUndefined();
+ expect(schema.additionalProperties).toBe(false);
- expect(schema).not.toHaveProperty('oneOf');
});
- it.each([false, true])('keeps action-specific schema validation aligned with execution (currentOnly=%s)', async (currentOnly) => {
+ it.each([false, true])('keeps common schema types and execution-time action checks (currentOnly=%s)', async (currentOnly) => {
writeConversation('current', 'Current task', [
{ id: 'prior', from: 'user', text: 'contractword previous decision' },
{ id: 'trigger', from: 'user', text: 'Find the earlier decision' },
@@@ -786,13 -709,16 +787,17 @@@
expect(result.isError).toBeFalsy();
expect(result.content).toContain('contractword');
}
- for (const harmless of [{ ...read, query: 'contractword' }, { ...read, k: 2 }, ...(!currentOnly ? [{ ...read, include_current: true }] : []), { ...search, page: read.page }]) {
- expect(schema.Check(harmless)).toBe(true);
- const result = await tool.execute(harmless, ctxFor());
- expect(result.isError).toBeFalsy();
- expect(result.content).toContain('contractword');
- }
- for (const invalid of [{ ...search, cid: 'sibling' }, ...['record_id', 'turn_id', 'tool_call_id'].map(key => ({ ...search, [key]: 'selected-record' })), { ...search, unknown_field: true }]) {
+ // Portable schemas admit known fields independently of the selected
+ // action; the executor still rejects cross-action combinations.
+ for (const invalid of [
+ { ...search, cid: 'sibling' },
++ ...['record_id', 'turn_id', 'tool_call_id'].map(key => ({ ...search, [key]: 'selected-record' })),
+ { ...read, query: 'contractword' },
+ { ...read, k: 2 },
+ { ...read, include_current: true },
+ ]) {
+ const hiddenFromCurrentOnly = currentOnly && ('cid' in invalid || 'include_current' in invalid);
+ expect(schema.Check(invalid), JSON.stringify(invalid)).toBe(!hiddenFromCurrentOnly);
const result = await tool.execute(invalid, ctxFor());
expect(result.isError).toBe(true);
expect(result.content).toContain('unsupported field(s)');
@@@ -800,8 -729,7 +808,6 @@@
expect(schema.Check({ action: 'search', scope })).toBe(true);
expect((await tool.execute({ action: 'search', scope }, ctxFor())).isError).toBe(true);
expect(schema.Check({ ...search, action: 'invalid' })).toBe(false);
- // Optional fields coexist in the portable schema; execution owns their action semantics.
-- expect(schema.Check({ ...search, page: read.page })).toBe(true);
});
it('keeps action guidance on the tool and paging semantics on their fields', async () => {
@@@ -841,7 -766,7 +847,7 @@@
expect((chatHistory.inputSchema as any).required).toEqual(['action', 'scope']);
});
- it('rejects a missing action and preserves exact read lookup despite extra search text', async () => {
- it('rejects a missing action and fields that belong to the other action', async () => {
++ it('rejects a missing action and cross-action read fields', async () => {
const [, , chatHistory] = await createChatHistoryActions({ userId: TEST_UID });
const missingAction = await chatHistory.execute({ query: 'x' }, ctxFor());
const crossActionField = await chatHistory.execute({
@@@ -850,7 -775,7 +856,7 @@@
expect(missingAction.isError).toBe(true);
expect(missingAction.content).toContain('`action`');
expect(crossActionField.isError).toBe(true);
- expect(crossActionField.content).not.toContain('unsupported field(s)');
- expect(crossActionField.content).toContain('unsupported field(s): query');
++ expect(crossActionField.content).toContain('unsupported field(s)');
});
it('retains runtime compatibility for legacy search calls that carried read paging metadata', async () => {
diff --cc test/main/model/core-agent/injected-tool-fixture.ts
index 679b52f2,5d6c15d1..bf44923b
--- a/test/main/model/core-agent/injected-tool-fixture.ts
+++ b/test/main/model/core-agent/injected-tool-fixture.ts
@@@ -14,13 -18,9 +18,9 @@@ import { createImageStudioTool } from '
import { createLibraryTool } from '../../../../src/main/model/core-agent/kb-tools';
import { createOfficeTools } from '../../../../src/main/model/core-agent/office-tools';
import { createPdfTools } from '../../../../src/main/model/core-agent/pdf-tools';
+import { createVideoGenTool } from '../../../../src/main/model/core-agent/video-gen-tool';
- import { buildBrowserTool } from '../../../../src/main/features/group_chat/browser_tool';
- import { createSkillManageTool } from '../../../../src/core-agent/src/evolution/skill-tools';
- import type { SkillStore } from '../../../../src/core-agent/src/evolution/skill-store';
- import { createRunProgramTool } from '../../../../src/core-agent/src/tools/run-program';
- import { createProjectTasksTool } from '../../../../src/core-agent/src/tools/project-tasks-tool';
import { createToolResultTools } from '../../../../src/main/model/core-agent/tool-result-tools';
+ import { buildBrowserTool } from '../../../../src/main/features/group_chat/browser_tool';
/** Late/runtime definitions omitted from the common actor-budget corpus below.
* Dependencies fail closed: schema inspection must not read or mutate state. */
diff --cc test/main/model/core-agent/kb-tools.test.ts
index fb06480b,679fee51..d9ac6fe0
--- a/test/main/model/core-agent/kb-tools.test.ts
+++ b/test/main/model/core-agent/kb-tools.test.ts
@@@ -474,10 -474,10 +474,11 @@@ describe('kb-tools › shape', () =>
expect(schema.properties).toHaveProperty('query');
expect(schema.properties).toHaveProperty('path');
expect(schema.additionalProperties).toBe(false);
+ expect(schema.oneOf).toBeUndefined();
+ expect(schema.required).toEqual(['action']);
- expect(schema).not.toHaveProperty('oneOf');
const missingAction = await library.execute({ query: 'alpha' }, ctxFor());
+ await seedFiles();
const crossActionField = await library.execute({
action: 'read', path: 'notes/a.md', query: 'alpha',
}, ctxFor());
diff --cc test/main/model/core-agent/office-tools.test.ts
index 19a82599,22806a21..33261f57
--- a/test/main/model/core-agent/office-tools.test.ts
+++ b/test/main/model/core-agent/office-tools.test.ts
@@@ -205,8 -204,9 +205,9 @@@ describe('Office built-in tools', () =
});
expect(Object.keys(schema.properties)).toEqual(['path', 'sheets', 'preview']);
const sheetProps = schema.properties.sheets.items.properties;
- const cellSchema = sheetProps.rows.items.items;
- expect(cellSchema.type).toEqual(['string', 'number', 'boolean', 'object']);
- const cellProps = cellSchema.properties;
+ const cellObjectSchema = sheetProps.rows.items.items;
++ expect(cellObjectSchema.type).toEqual(['string', 'number', 'boolean', 'object']);
+ const cellProps = cellObjectSchema.properties;
const chartProps = sheetProps.charts.items.properties;
expect(cellProps).toEqual(expect.objectContaining({
formula: expect.any(Object),
diff --cc test/main/model/core-agent/tool-result-tools.test.ts
index 5585f661,ab4052c9..7826b44f
--- a/test/main/model/core-agent/tool-result-tools.test.ts
+++ b/test/main/model/core-agent/tool-result-tools.test.ts
@@@ -547,22 -438,25 +547,37 @@@ describe('persisted tool-result retriev
expect(tools.map((tool) => tool.name)).toEqual(['tool_result']);
const schema = getTool(tools, 'tool_result').inputSchema as any;
+ expect(schema.oneOf).toBeUndefined();
expect(schema.required).toEqual(['action', 'requests']);
expect(schema.properties.action.enum).toEqual(['search', 'query', 'read', 'materialize']);
- expect(schema).not.toHaveProperty('oneOf');
const request = schema.properties.requests.items;
+ expect(request).not.toHaveProperty('anyOf');
+ expect(request).toMatchObject({ type: 'object', additionalProperties: false, required: ['ref'] });
+ expect(Object.keys(request.properties).sort()).toEqual([
+ 'ref', 'query', 'operation', 'dataset', 'explode', 'field', 'filters',
+ 'group_by', 'order', 'limit', 'match', 'count_unit', 'cursor', 'max_tokens',
+ ].sort());
+ expect(request.properties.operation.enum).toEqual(['count', 'sum', 'average', 'minimum', 'maximum']);
+ expect(request.properties.operation.description).toContain('Required for query');
+ expect(request.properties.query.description).toContain('Required for search');
+ expect(request.properties.cursor.description).toContain('Required for read');
+ expect(request.properties.explode.description).toMatch(/\$item[\s\S]*\$parent[\s\S]*\$index/);
+ expect(getTool(tools, 'tool_result').description).toMatch(/at most one tool_result call per model step/i);
+ expect(request.required).toEqual(['ref']);
+ expect(request.additionalProperties).toBe(false);
+ expect(request).not.toHaveProperty('oneOf');
+ expect(request).not.toHaveProperty('anyOf');
+ expect(request.properties.operation.enum).toEqual(['count', 'sum', 'average', 'minimum', 'maximum']);
+ expect(request.properties).toEqual(expect.objectContaining({
+ ref: expect.any(Object), query: expect.any(Object), cursor: expect.any(Object),
+ max_tokens: expect.any(Object), operation: expect.any(Object), match: expect.any(Object),
+ count_unit: expect.any(Object), dataset: expect.any(Object),
+ }));
+ expect(getTool(tools, 'tool_result').description).toMatch(/at most one tool_result call per model step/i);
+ expect(schema.properties.action.description)
+ .toMatch(/full-data calculations.*query cannot express/);
+ expect(schema.properties.action.description).toMatch(/source excerpts/);
+ expect(schema.properties.action.description).not.toMatch(/query\/search cannot answer/);
const invalid = await getTool(tools, 'tool_result').execute({
action: 'unknown',