Skip to content

Commit 22e1089

Browse files
feat(spec): list list_flow_runs among the service-ai-studio platform tools (#38193)
<!-- claude-projects-attribution: {"github_login":"os-sales"} --> _Requested by **Sales** · [project thread](https://claude.ai/code/project/chan_01D5bWFY3rFzgJcytD5gD4Uu?thread=cmsg_01D5bWFY3rFzgJcytD5gD4UuEKqL1r3otpmPGByaZzap4u)_ Fixes #34372 Clause-②: yes (widening) Metadata-protocol: none ## 维护者速读 - 搭建助手新增的「查看自动化运行记录」工具,现在登记进平台工具名表;技能里写上这个工具名,校验不再把它当成不存在的工具拒掉。 - 替云端搭建助手解决:它要回答「我的自动化跑成功了吗」,靠的就是这个工具。 - 只是多认一个工具名,不改任何已有工具;出问题直接撤回这个改动即可。 - 无。 ## What changes - `packages/spec/src/system/constants/platform-tool-names.ts`: `'list_flow_runs'` joins `PLATFORM_TOOLS_BY_PACKAGE['service-ai-studio']` in its alphabetical place (after `get_record_history`, before `list_metadata`), and the group's doc comment names it. `PLATFORM_PROVIDED_TOOL_NAMES` therefore carries it and `isPlatformProvidedToolName('list_flow_runs')` answers `true`, so a skill whose `tools[]` names it resolves under ADR-0109 reference integrity instead of being reported as `ai-skill-tool-unresolved`. - `ui/packages/plugin-chatbot/src/__tests__/toolLabels-locale-parity-7481.test.ts`: `list_flow_runs` moves from `AHEAD_OF_PIN` (now empty) to `GRADUATED`, per the file's own note. The ui half (#34368, PR #34379) already put its label in every locale pack. This move must ride with the registry entry: with the entry and without the move, the `AHEAD_OF_PIN carries only names the pinned registry still lacks` case turns red (plugin-chatbot reads `@objectstack/spec` as `workspace:^`). - Changeset: `@objectstack/spec` patch (`.changeset/34372-list-flow-runs-registry.md`). Contract review M1 (7235393865, seat revision 7235409030): `SkillSchema.tools` is a free string array, so what an author can write parses the same; the only behaviour change is that one advisory lint warning no longer fires. Same as the registry's earlier additions #32668 and #37989. - Resumed from `claude/project-thread-a7rk9c@f754db1` (release comment 6929523318): its two commits were cherry-picked onto current `main`; the old main merge was not reused. Two conflicts resolved by keeping both sides: the `service-ai-studio` doc comment (main had added `ask_which`, cloud#4773) and the spec test (main had added the `get_record_context` case). ## Tests - `platform-tool-names.test.ts`: new case, the group contains `list_flow_runs`, `isPlatformProvidedToolName('list_flow_runs')` is `true`, control `list_flow_run` is `false`. 13/13 pass. - `packages/lint/src/validate-ai-tool-references.test.ts`: new case, a skill naming `list_flow_runs` yields no finding; control, a fictional neighbour `retry_flow_run` in the same list is still reported at `skills[0].tools[1]`. 46/46 pass. - ui `toolLabels-locale-parity-7481.test.ts` + `toolLabels-sentences-12724.test.ts`: 30/30 pass at c5e44f0. Review N2, at 2c464d4: the zh case that looped over `AHEAD_OF_PIN` (now empty, so it asserted nothing) loops over `GRADUATED` with a non-empty guard; 7481 file 17/17. <details><summary>Ablation</summary> - Deleted the `'list_flow_runs',` registry line, rebuilt `@objectstack/spec`, re-ran: the spec case `lists the build agent's read-only flow-run reader` red (1 failed / 12 passed); the ui 7481 file red on `reads a non-empty coverage set` and `AHEAD_OF_PIN carries only names the pinned registry still lacks` (the GRADUATED guard). Restored from the index, rebuilt, green again. </details> ## Acceptance notes - No other enumerating reader of the registry: `git grep get_record_history` outside the registry hits only locale packs, changelogs and a release page. - Review N1 (nit, not taken): the jsdoc carries no cloud reference for `list_flow_runs`; no cloud issue number is named on #34368 or this card, and the cloud repo is outside this session's reach. - The cloud side deletes its AHEAD entry for this name on the pin bump that carries this (card item 4, cloud repo, not in this PR). ## Verification - `pnpm --filter @objectstack/spec build && pnpm --filter @objectstack/spec exec vitest run src/system/constants/platform-tool-names.test.ts` — expect 13 passed. - Local derived gates (`dispatch-gates.mjs --commands`, 89 commands at c5e44f0): 86 exit 0 (two of them, `lint check:doc-formula-expressions` and `check:docs-transcript-drift`, after building the `@objectstack/lint` closure; first run was PREREQUISITE NOT MET). Not measured locally, CI runs them: `check:dual-build-cjs-loads` and `check:lean-entry-closure` (PREREQUISITE NOT MET: they load built output of packages this worktree did not build), and `pnpm --dir ui exec vitest run scripts/` (1 of 5146 red: `unit-registry-absence-collision` cannot resolve the unbuilt `@objectstack/client` entry; the closure-budget half wants a built console). No `!` in the title and no narrowing arm, so no dogfood battery is owed. --- _Generated by [Claude Code](https://claude.ai/code/session_01L6bhgXM39VND2qb8HbebbK)_ <!-- signed: repo:objectstack#2 · os-sales · session_01L6bhgXM39VND2qb8HbebbK --> --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 2d7bf92 commit 22e1089

5 files changed

Lines changed: 60 additions & 11 deletions

File tree

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
'@objectstack/spec': patch
3+
---
4+
5+
feat(spec): `PLATFORM_TOOLS_BY_PACKAGE['service-ai-studio']` lists `list_flow_runs`
6+
7+
Clause-②: yes (widening)
8+
Metadata-protocol: none
9+
10+
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.

‎packages/lint/src/validate-ai-tool-references.test.ts‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,23 @@ describe('validate-ai-tool-references', () => {
451451
expect(control[0].message).toContain('delete_packages');
452452
});
453453

454+
/**
455+
* The build agent's read-only flow-run reader: a skill naming
456+
* `list_flow_runs` resolves; a near name nobody registers does not.
457+
*/
458+
it('resolves the service-ai-studio flow-run reader', () => {
459+
expect(validateAiToolReferences({ skills: [{ name: 's', tools: ['list_flow_runs'] }] })).toEqual([]);
460+
461+
// The control: a fictional neighbour registered by nobody is still
462+
// reported, so this pin fails on a universe widened too far.
463+
const control = validateAiToolReferences({
464+
skills: [{ name: 's', tools: ['list_flow_runs', 'retry_flow_run'] }],
465+
});
466+
expect(control).toHaveLength(1);
467+
expect(control[0].path).toBe('skills[0].tools[1]');
468+
expect(control[0].message).toContain('retry_flow_run');
469+
});
470+
454471
it('reports stable paths and tolerates junk shapes', () => {
455472
const stack = {
456473
skills: [{ name: 's', tools: ['query_records', 'nope_tool'] }],

‎packages/spec/src/system/constants/platform-tool-names.test.ts‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,15 @@ describe('PLATFORM_PROVIDED_TOOL_NAMES — internal invariants', () => {
7878
expect(PLATFORM_TOOLS_BY_PACKAGE['service-ai-studio']).not.toContain(GET_RECORD_CONTEXT_TOOL_NAME);
7979
});
8080

81+
it('lists the build agent\'s read-only flow-run reader', () => {
82+
// Cloud `service-ai-studio` registers it; while the registry lacked it, a
83+
// skill naming it read as a fictional tool.
84+
expect(PLATFORM_TOOLS_BY_PACKAGE['service-ai-studio']).toContain('list_flow_runs');
85+
expect(isPlatformProvidedToolName('list_flow_runs')).toBe(true);
86+
// The control: the singular nobody registers still misses.
87+
expect(isPlatformProvidedToolName('list_flow_run')).toBe(false);
88+
});
89+
8190
it('each group is sorted, so diffs stay reviewable', () => {
8291
for (const [pkg, names] of Object.entries(PLATFORM_TOOLS_BY_PACKAGE)) {
8392
expect([...names].sort(), pkg).toEqual([...names]);

‎packages/spec/src/system/constants/platform-tool-names.ts‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,12 @@ export const PLATFORM_TOOLS_BY_PACKAGE: Readonly<Record<string, readonly string[
8888
* (cloud#3656), and the `ask` agent's read-only `get_record_history`, which
8989
* reads one record's change history the user may see so a chat can undo the
9090
* last edit — the restore itself still goes through a confirm card
91-
* (cloud#4347), and the `ask` agent's `ask_which`, which writes nothing:
91+
* (cloud#4347), the `ask` agent's `ask_which`, which writes nothing:
9292
* when a data question has 2–3 plausible readings it returns them to the
93-
* user as a question and ends the turn (cloud#4773).
93+
* user as a question and ends the turn (cloud#4773), and the build agent's
94+
* read-only `list_flow_runs`, which reads one flow's recent runs as the
95+
* caller so the agent can answer "did my automation work?" from a run's own
96+
* outcome.
9497
*/
9598
'service-ai-studio': [
9699
'add_field',
@@ -111,6 +114,7 @@ export const PLATFORM_TOOLS_BY_PACKAGE: Readonly<Record<string, readonly string[
111114
'get_metadata_schema',
112115
'get_package',
113116
'get_record_history',
117+
'list_flow_runs',
114118
'list_metadata',
115119
'list_objects',
116120
'list_packages',

‎ui/packages/plugin-chatbot/src/__tests__/toolLabels-locale-parity-7481.test.ts‎

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@
2525
* was written around — `get_authoring_rules` (cloud#1837), `load_tools`,
2626
* `open_record`, `test_flow`, `toggle_flow` — are all in
2727
* `PLATFORM_TOOLS_BY_PACKAGE` as of `@objectstack/spec` 17.4.0, so they left
28-
* {@link AHEAD_OF_PIN} (objectui#8772 took the pin there). ⛔ The list is kept,
28+
* {@link AHEAD_OF_PIN} (objectui#8772 took the pin there); `list_flow_runs`
29+
* followed when objectstack#34372 listed it. ⛔ The list is kept,
2930
* not deleted: the next tool the cloud registers ahead of a snapshot needs the
3031
* same hatch, and rebuilding it under pressure is how a permanent second
3132
* registry starts. {@link GRADUATED} keeps this file's guards honest whenever
@@ -56,11 +57,9 @@ const REGISTRY = (
5657
* list yet — sourced from cloud `service-ai-studio`'s `plugin.ts` tool
5758
* definitions. Shrink this list on a pin bump — never grow it as a habit.
5859
*
59-
* `list_flow_runs` (the build agent's read-only reader of a flow's recent
60-
* runs) waits on the registry entry that objectstack#34372 adds; that change
61-
* moves it from here to {@link GRADUATED}.
60+
* EMPTY at this pin: every name it carried has graduated (see {@link GRADUATED}).
6261
*/
63-
const AHEAD_OF_PIN: readonly string[] = ['list_flow_runs'];
62+
const AHEAD_OF_PIN: readonly string[] = [];
6463

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

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

144-
it('zh: the other four newly-mapped tools resolve too', () => {
150+
it('zh: every graduated tool resolves to its pack label too', () => {
151+
// Iterates GRADUATED, not AHEAD_OF_PIN: the hand-held list is empty at
152+
// this pin, and a loop over it would assert nothing.
145153
const tt = ttFrom('zh-Hans');
146-
for (const name of AHEAD_OF_PIN) {
154+
expect(GRADUATED.length).toBeGreaterThan(0);
155+
for (const name of GRADUATED) {
147156
expect(humanizeToolName(name, tt), name).toBe(toolsOf('zh-Hans')![name]);
148157
}
149158
});

0 commit comments

Comments
 (0)