Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .changeset/34372-list-flow-runs-registry.md
Original file line number Diff line number Diff line change
@@ -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.
17 changes: 17 additions & 0 deletions packages/lint/src/validate-ai-tool-references.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'] }],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
Expand Down
8 changes: 6 additions & 2 deletions packages/spec/src/system/constants/platform-tool-names.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,12 @@ export const PLATFORM_TOOLS_BY_PACKAGE: Readonly<Record<string, readonly string[
* (cloud#3656), and the `ask` agent's read-only `get_record_history`, which
* reads one record's change history the user may see so a chat can undo the
* last edit — the restore itself still goes through a confirm card
* (cloud#4347), and the `ask` agent's `ask_which`, which writes nothing:
* (cloud#4347), the `ask` agent's `ask_which`, which writes nothing:
* when a data question has 2–3 plausible readings it returns them to the
* user as a question and ends the turn (cloud#4773).
* user as a question and ends the turn (cloud#4773), and the build agent's
* read-only `list_flow_runs`, which reads one flow's recent runs as the
* caller so the agent can answer "did my automation work?" from a run's own
* outcome.
*/
'service-ai-studio': [
'add_field',
Expand All @@ -111,6 +114,7 @@ export const PLATFORM_TOOLS_BY_PACKAGE: Readonly<Record<string, readonly string[
'get_metadata_schema',
'get_package',
'get_record_history',
'list_flow_runs',
'list_metadata',
'list_objects',
'list_packages',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
* was written around — `get_authoring_rules` (cloud#1837), `load_tools`,
* `open_record`, `test_flow`, `toggle_flow` — are all in
* `PLATFORM_TOOLS_BY_PACKAGE` as of `@objectstack/spec` 17.4.0, so they left
* {@link AHEAD_OF_PIN} (objectui#8772 took the pin there). ⛔ The list is kept,
* {@link AHEAD_OF_PIN} (objectui#8772 took the pin there); `list_flow_runs`
* followed when objectstack#34372 listed it. ⛔ The list is kept,
* not deleted: the next tool the cloud registers ahead of a snapshot needs the
* same hatch, and rebuilding it under pressure is how a permanent second
* registry starts. {@link GRADUATED} keeps this file's guards honest whenever
Expand Down Expand Up @@ -56,11 +57,9 @@ const REGISTRY = (
* list yet — sourced from cloud `service-ai-studio`'s `plugin.ts` tool
* definitions. Shrink this list on a pin bump — never grow it as a habit.
*
* `list_flow_runs` (the build agent's read-only reader of a flow's recent
* runs) waits on the registry entry that objectstack#34372 adds; that change
* moves it from here to {@link GRADUATED}.
* EMPTY at this pin: every name it carried has graduated (see {@link GRADUATED}).
*/
const AHEAD_OF_PIN: readonly string[] = ['list_flow_runs'];
const AHEAD_OF_PIN: readonly string[] = [];

/**
* The names that HAVE graduated from {@link AHEAD_OF_PIN} into the registry.
Expand All @@ -70,10 +69,17 @@ const AHEAD_OF_PIN: readonly string[] = ['list_flow_runs'];
* being non-empty, so with it emptied they would read green against a
* `PLATFORM_TOOLS_BY_PACKAGE` that had vanished, gone empty, or lost these very
* names: `[].filter(…)` is `[]` and `arrayContaining([])` passes on anything.
* Asserting these five ARE in the registry is the reading that cannot be
* Asserting these names ARE in the registry is the reading that cannot be
* satisfied by an absent export, and it is the same fact the emptying rests on.
*/
const GRADUATED = ['get_authoring_rules', 'load_tools', 'open_record', 'test_flow', 'toggle_flow'] as const;
const GRADUATED = [
'get_authoring_rules',
'list_flow_runs',
'load_tools',
'open_record',
'test_flow',
'toggle_flow',
] as const;

/** Every tool name that must carry a step label in every pack. */
const COVERED: string[] = [
Expand Down Expand Up @@ -141,9 +147,12 @@ describe('humanizeToolName resolves the newer tools through the pack (objectui#7
expect(humanizeToolName('get_authoring_rules', ttFrom('zh-Hans'))).not.toBe('Get authoring rules');
});

it('zh: the other four newly-mapped tools resolve too', () => {
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]);
}
});
Expand Down
Loading