diff --git a/.changeset/34372-list-flow-runs-registry.md b/.changeset/34372-list-flow-runs-registry.md new file mode 100644 index 00000000000..ef48a4d7422 --- /dev/null +++ b/.changeset/34372-list-flow-runs-registry.md @@ -0,0 +1,10 @@ +--- +'@objectstack/spec': patch +--- + +feat(spec): `PLATFORM_TOOLS_BY_PACKAGE['service-ai-studio']` lists `list_flow_runs` + +Clause-②: yes (widening) +Metadata-protocol: none + +The cloud build agent gains a read-only `list_flow_runs` tool: it reads one flow's recent runs as the caller, so the agent can answer "did my automation work?" from a run's own outcome. The registry lists the name in its alphabetical place, so `PLATFORM_PROVIDED_TOOL_NAMES` carries it and `isPlatformProvidedToolName('list_flow_runs')` answers `true`. A skill whose `tools[]` names `list_flow_runs` now resolves under ADR-0109 reference integrity instead of being reported as a fictional tool (`ai-skill-tool-unresolved`). The chat panel's step label for the tool is in every built-in locale pack. No schema shape changes and no export is added or removed. diff --git a/packages/lint/src/validate-ai-tool-references.test.ts b/packages/lint/src/validate-ai-tool-references.test.ts index 7d5ca048bc7..974bebdb1ca 100644 --- a/packages/lint/src/validate-ai-tool-references.test.ts +++ b/packages/lint/src/validate-ai-tool-references.test.ts @@ -451,6 +451,23 @@ describe('validate-ai-tool-references', () => { expect(control[0].message).toContain('delete_packages'); }); + /** + * The build agent's read-only flow-run reader: a skill naming + * `list_flow_runs` resolves; a near name nobody registers does not. + */ + it('resolves the service-ai-studio flow-run reader', () => { + expect(validateAiToolReferences({ skills: [{ name: 's', tools: ['list_flow_runs'] }] })).toEqual([]); + + // The control: a fictional neighbour registered by nobody is still + // reported, so this pin fails on a universe widened too far. + const control = validateAiToolReferences({ + skills: [{ name: 's', tools: ['list_flow_runs', 'retry_flow_run'] }], + }); + expect(control).toHaveLength(1); + expect(control[0].path).toBe('skills[0].tools[1]'); + expect(control[0].message).toContain('retry_flow_run'); + }); + it('reports stable paths and tolerates junk shapes', () => { const stack = { skills: [{ name: 's', tools: ['query_records', 'nope_tool'] }], diff --git a/packages/spec/src/system/constants/platform-tool-names.test.ts b/packages/spec/src/system/constants/platform-tool-names.test.ts index d82fd2197cd..58cb0049506 100644 --- a/packages/spec/src/system/constants/platform-tool-names.test.ts +++ b/packages/spec/src/system/constants/platform-tool-names.test.ts @@ -78,6 +78,15 @@ describe('PLATFORM_PROVIDED_TOOL_NAMES — internal invariants', () => { expect(PLATFORM_TOOLS_BY_PACKAGE['service-ai-studio']).not.toContain(GET_RECORD_CONTEXT_TOOL_NAME); }); + it('lists the build agent\'s read-only flow-run reader', () => { + // Cloud `service-ai-studio` registers it; while the registry lacked it, a + // skill naming it read as a fictional tool. + expect(PLATFORM_TOOLS_BY_PACKAGE['service-ai-studio']).toContain('list_flow_runs'); + expect(isPlatformProvidedToolName('list_flow_runs')).toBe(true); + // The control: the singular nobody registers still misses. + expect(isPlatformProvidedToolName('list_flow_run')).toBe(false); + }); + it('each group is sorted, so diffs stay reviewable', () => { for (const [pkg, names] of Object.entries(PLATFORM_TOOLS_BY_PACKAGE)) { expect([...names].sort(), pkg).toEqual([...names]); diff --git a/packages/spec/src/system/constants/platform-tool-names.ts b/packages/spec/src/system/constants/platform-tool-names.ts index 3858e1b8ad7..dfa10b8a876 100644 --- a/packages/spec/src/system/constants/platform-tool-names.ts +++ b/packages/spec/src/system/constants/platform-tool-names.ts @@ -88,9 +88,12 @@ export const PLATFORM_TOOLS_BY_PACKAGE: Readonly { + it('zh: every graduated tool resolves to its pack label too', () => { + // Iterates GRADUATED, not AHEAD_OF_PIN: the hand-held list is empty at + // this pin, and a loop over it would assert nothing. const tt = ttFrom('zh-Hans'); - for (const name of AHEAD_OF_PIN) { + expect(GRADUATED.length).toBeGreaterThan(0); + for (const name of GRADUATED) { expect(humanizeToolName(name, tt), name).toBe(toolsOf('zh-Hans')![name]); } });