expo-syrup-ai-kit 0.3.0 → 0.3.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.
package/README.md CHANGED
@@ -25,8 +25,11 @@ The full setup, including the Mac, the iPhone and a checklist for coding agents,
25
25
 
26
26
  ```bash
27
27
  npx expo install expo-syrup-ai-kit expo-app-intents
28
+ npx expo-app-intents init --examples minimal
28
29
  ```
29
30
 
31
+ `init` creates `app-intents/AppIntentsSetup.swift`, the inline module used in [Showing the tool's outcome](#showing-the-tools-outcome-in-your-app), and turns on inline modules in `app.json`. `npx expo install` adds both plugins; list them in this order:
32
+
30
33
  ```json
31
34
  {
32
35
  "expo": {
@@ -38,13 +41,15 @@ npx expo install expo-syrup-ai-kit expo-app-intents
38
41
  Then prebuild with the preview on:
39
42
 
40
43
  ```bash
41
- SIRI_AI_PREVIEW=1 npx expo prebuild -p ios
44
+ SIRI_AI_PREVIEW=1 CP_CACHE_DIR="$PWD/.cp-cache" LANG=en_US.UTF-8 npx expo prebuild -p ios
42
45
  ```
43
46
 
47
+ `CP_CACHE_DIR` gives CocoaPods a cache of its own, which avoids a missing-`Info.plist` failure from a broken shared cache. `LANG` avoids a CocoaPods encoding error.
48
+
44
49
  ## Options
45
50
 
46
51
  ```json
47
- ["expo-syrup-ai-kit", { "version": "0.3.0", "preview": true }]
52
+ ["expo-syrup-ai-kit", { "version": "0.3.1", "preview": true }]
48
53
  ```
49
54
 
50
55
  | Option | Default | What it does |
@@ -74,9 +79,12 @@ On every prebuild the plugin adds a `<AppName>Evals` UI test target that:
74
79
  Run the evaluations on an iPhone on iOS 27.3 with Siri AI on:
75
80
 
76
81
  ```bash
77
- xcodebuild test -workspace ios/MyApp.xcworkspace -scheme MyAppEvals -destination 'platform=iOS,name=My iPhone'
82
+ xcodebuild test -workspace ios/MyApp.xcworkspace -scheme MyAppEvals -configuration Release \
83
+ -destination 'platform=iOS,name=My iPhone' -resultBundlePath evals.xcresult
78
84
  ```
79
85
 
86
+ Use Release so the JavaScript is in the app. A Debug build loads it from the dev server, so it only starts while `npx expo start` is running.
87
+
80
88
  Prebuild fails with a clear message if `sourceDir` doesn't exist or has no `.swift` files. The file list is read at prebuild, so prebuild again after adding or removing a test file.
81
89
 
82
90
  ## App Skills
@@ -111,6 +119,8 @@ Prebuild stops, listing every problem, if a skill breaks Apple's rules. Xcode it
111
119
  - The body is at most 10,000 characters.
112
120
  - Each skill folder holds only its `SKILL.md`.
113
121
 
122
+ **A skill only helps if Siri can chain your tools, and today it can't chain a tool that returns a dialog.** Such a tool returns `.result(value:dialog:)`, as in [A first tool](#a-first-tool), and so does every tool the `tools` option generates unless it sets `"returns": "value"`. On a phone, Siri speaks a dialog and ends the turn. Tools that return only `.result(value:)` let Siri call one after another, and in the same test Siri chained them with or without a skill. The skill changed only how Siri worded the answer. So every tool a skill names should return only `.result(value:)`: in Swift, drop `ProvidesDialog` and the `dialog:` argument; in a declaration, set `"returns": "value"`. See [docs/spikes/app-skills-bundle.md](https://github.com/airowe/syrup-ai-kit/blob/main/docs/spikes/app-skills-bundle.md#device-runs) and [#31](https://github.com/airowe/syrup-ai-kit/issues/31).
123
+
114
124
  Skills guide Siri; they don't guarantee it follows the steps in order. Nothing checks that a skill names tools your app has, so test the flow with a Siri evaluation. App Skills are part of the Siri AI Developer Preview, with the same limits on who can use them (see the [SyrupAIKit README](https://github.com/airowe/syrup-ai-kit#readme)).
115
125
 
116
126
  ## A first tool
@@ -121,7 +131,7 @@ import AppIntents
121
131
  import Foundation
122
132
  import SyrupAIKit
123
133
 
124
- private let tool = SiriTool(appName: "My App")
134
+ private let tool = SiriTool(appName: "Sample App")
125
135
 
126
136
  #if SIRI_AI_PREVIEW
127
137
  @AppIntent(.tool)
@@ -176,6 +186,11 @@ Instead of writing Swift, list tools that call your HTTP API in a JSON file and
176
186
 
177
187
  A parameter's optional `description` is one line saying what the person gives, with an example. Siri reads it to fill the value.
178
188
 
189
+ A tool's optional `returns` says what Siri gets back:
190
+
191
+ - `"dialog"` (the default): Siri says the reply word for word and ends its turn.
192
+ - `"value"`: Siri gets the reply to use, words the answer itself, and can call another tool first. Use it for tools an [App Skill](#app-skills) names, or any tool Siri should combine with others.
193
+
179
194
  At prebuild the plugin writes one Swift tool per entry, plus a shared `SiriToolsGenerated.swift`, to `ios/<App>/SiriTools/` and compiles that folder into the app target. A bad declaration stops prebuild with every problem listed. The format, what it supports and what's still open are in [docs/spikes/tool-codegen.md](../docs/spikes/tool-codegen.md).
180
195
 
181
196
  ## Implementing the tools discovery proposes
@@ -188,15 +203,45 @@ The `siri-ai-discover` skill writes each tool's interface to `siri-tools.json`,
188
203
 
189
204
  ## Showing the tool's outcome in your app
190
205
 
191
- Siri Evaluations read the last outcome from the screen. Expose it from your `AppIntentsSetup` inline module:
206
+ Siri Evaluations read the last outcome from the screen. Expose it from your `AppIntentsSetup` inline module, the one `npx expo-app-intents init` created:
192
207
 
193
208
  ```swift
194
- Function("siriToolOutcome") { () -> String in
195
- ToolOutcomeLog.standard.last
209
+ // app-intents/AppIntentsSetup.swift
210
+ internal import ExpoAppIntents
211
+ internal import ExpoModulesCore
212
+ import SyrupAIKit
213
+
214
+ final class AppIntentsSetup: Module {
215
+ public func definition() -> ExpoModulesCore.ModuleDefinition {
216
+ Name("AppIntentsSetup")
217
+
218
+ Function("siriToolOutcome") { () -> String in
219
+ ToolOutcomeLog.standard.last
220
+ }
221
+ }
196
222
  }
197
223
  ```
198
224
 
199
- Then render it from JavaScript with `testID="siri-ai-tool-outcome"`.
225
+ Import `SyrupAIKit` the same way in every file in `app-intents/`. Here it's a plain `import`, as in [A first tool](#a-first-tool). If one file says `internal import SyrupAIKit` and another `import SyrupAIKit`, the build fails with "ambiguous implicit access level".
226
+
227
+ Then show it on a screen that's always visible, with `testID="siri-ai-tool-outcome"`:
228
+
229
+ ```tsx
230
+ import { requireNativeModule } from 'expo';
231
+ import { useEffect, useState } from 'react';
232
+ import { Text } from 'react-native';
233
+
234
+ const Setup = requireNativeModule<{ siriToolOutcome(): string }>('AppIntentsSetup');
235
+
236
+ export function SiriToolOutcome() {
237
+ const [outcome, setOutcome] = useState(Setup.siriToolOutcome());
238
+ useEffect(() => {
239
+ const poll = setInterval(() => setOutcome(Setup.siriToolOutcome()), 1000);
240
+ return () => clearInterval(poll);
241
+ }, []);
242
+ return <Text testID="siri-ai-tool-outcome">{outcome}</Text>;
243
+ }
244
+ ```
200
245
 
201
246
  ## Agent skills
202
247
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-syrup-ai-kit",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "Make your Expo or React Native app work with Siri AI: the Expo config plugin for Syrup AI Kit and Apple's Siri AI Developer Preview, with agent skills.",
5
5
  "main": "app.plugin.js",
6
6
  "types": "plugin/build/index.d.ts",
@@ -12,7 +12,7 @@ const withSiriSkills_1 = require("./withSiriSkills");
12
12
  const withSiriTools_1 = require("./withSiriTools");
13
13
  const pkg = require('../../package.json');
14
14
  /** The SyrupAIKit release this plugin version was tested with. */
15
- const DEFAULT_VERSION = '0.3.0';
15
+ const DEFAULT_VERSION = '0.3.1';
16
16
  function requirementFrom(props) {
17
17
  if (props.version && props.branch) {
18
18
  throw new Error('expo-syrup-ai-kit: pass either `version` or `branch`, not both');
@@ -19,6 +19,9 @@ export type ToolRequest = {
19
19
  url: string;
20
20
  body: string[];
21
21
  };
22
+ /** `dialog`: Siri speaks the reply and ends the turn. `value`: Siri gets the reply to use, so it can chain tools. */
23
+ declare const RETURNS: readonly ["dialog", "value"];
24
+ export type ToolReturns = (typeof RETURNS)[number];
22
25
  export type ToolDeclaration = {
23
26
  name: string;
24
27
  title: string;
@@ -26,6 +29,7 @@ export type ToolDeclaration = {
26
29
  parameters: ToolParameter[];
27
30
  request: ToolRequest;
28
31
  reply: string;
32
+ returns: ToolReturns;
29
33
  };
30
34
  export type SiriToolsDeclaration = {
31
35
  appName?: string;
@@ -8,6 +8,8 @@ exports.parseSiriTools = parseSiriTools;
8
8
  exports.SCALAR_TYPES = ['string', 'int', 'double', 'bool', 'date'];
9
9
  const PARAMETER_TYPES = [...exports.SCALAR_TYPES, 'enum'];
10
10
  const METHODS = ['GET', 'POST', 'PUT', 'PATCH', 'DELETE'];
11
+ /** `dialog`: Siri speaks the reply and ends the turn. `value`: Siri gets the reply to use, so it can chain tools. */
12
+ const RETURNS = ['dialog', 'value'];
11
13
  const TYPE_NAME = /^[A-Z][A-Za-z0-9]*$/;
12
14
  const PROPERTY_NAME = /^[a-z][A-Za-z0-9]*$/;
13
15
  const FIELD_PATH = /^[A-Za-z0-9_]+(\.[A-Za-z0-9_]+)*$/;
@@ -17,7 +19,7 @@ const RESERVED = new Set(('associatedtype class deinit enum extension fileprivat
17
19
  'private precedencegroup protocol public rethrows static struct subscript typealias var break case catch ' +
18
20
  'continue default defer do else fallthrough for guard if in repeat return throw switch where while as Any ' +
19
21
  'await false is nil self Self super throws true try title description perform').split(' '));
20
- const TOOL_FIELDS = ['name', 'title', 'description', 'parameters', 'request', 'reply'];
22
+ const TOOL_FIELDS = ['name', 'title', 'description', 'parameters', 'request', 'reply', 'returns'];
21
23
  const PARAMETER_FIELDS = ['name', 'type', 'title', 'description', 'cases'];
22
24
  const REQUEST_FIELDS = ['method', 'url', 'body'];
23
25
  const isObject = (value) => typeof value === 'object' && value !== null && !Array.isArray(value);
@@ -161,6 +163,9 @@ function toolProblems(tool, path) {
161
163
  ...requestProblems(tool.request, names.filter((name) => typeof name === 'string'), `${path}.request`),
162
164
  ...unusedParameterProblems(tool, parameters, path),
163
165
  ...replyProblems(tool.reply, `${path}.reply`),
166
+ ...(tool.returns === undefined || RETURNS.includes(tool.returns)
167
+ ? []
168
+ : [`${path}.returns: must be "dialog" or "value"`]),
164
169
  ];
165
170
  }
166
171
  /** Every problem with a declaration, in a form a person can fix from; empty when it's valid. */
@@ -192,6 +197,7 @@ function withDefaults(tool) {
192
197
  body: (request.body ?? []),
193
198
  },
194
199
  reply: tool.reply,
200
+ returns: (tool.returns ?? 'dialog'),
195
201
  };
196
202
  }
197
203
  /** The declaration with defaults filled in, or an error listing every problem in `source`. */
@@ -6,7 +6,10 @@ export type GeneratedFile = {
6
6
  export declare const SUPPORT_FILE = "SiriToolsGenerated.swift";
7
7
  /** A Swift string literal that reads exactly as `value`, with nothing interpolated. */
8
8
  export declare function swiftString(value: string): string;
9
- /** One tool intent: Siri fills the parameters, the intent calls the API, and the reply template becomes the answer. */
9
+ /**
10
+ * One tool intent: Siri fills the parameters, the intent calls the API, and the reply template becomes the answer.
11
+ * A `dialog` tool has Siri speak the answer and end the turn; a `value` tool hands it to Siri, which can chain tools.
12
+ */
10
13
  export declare function toolSwift(tool: ToolDeclaration): string;
11
14
  /** Code every generated tool shares: the `SiriTool`, the HTTP request and the reply template. */
12
15
  export declare function supportSwift(appName: string): string;
@@ -60,7 +60,10 @@ ${displays.join('')} ]
60
60
  }
61
61
  `;
62
62
  }
63
- /** One tool intent: Siri fills the parameters, the intent calls the API, and the reply template becomes the answer. */
63
+ /**
64
+ * One tool intent: Siri fills the parameters, the intent calls the API, and the reply template becomes the answer.
65
+ * A `dialog` tool has Siri speak the answer and end the turn; a `value` tool hands it to Siri, which can chain tools.
66
+ */
64
67
  function toolSwift(tool) {
65
68
  const enums = tool.parameters.flatMap((parameter) => (parameter.type === 'enum' ? [enumSwift(tool, parameter)] : []));
66
69
  return `${HEADER}
@@ -74,7 +77,7 @@ struct ${intentName(tool)}: AppIntent {
74
77
  static let title: LocalizedStringResource = ${swiftString(tool.title)}
75
78
  static let description = IntentDescription(${swiftString(tool.description)})
76
79
  ${tool.parameters.map((parameter) => parameterSwift(tool, parameter)).join('')}
77
- func perform() async throws -> some IntentResult & ReturnsValue<String> & ProvidesDialog {
80
+ func perform() async throws -> some IntentResult & ReturnsValue<String>${tool.returns === 'dialog' ? ' & ProvidesDialog' : ''} {
78
81
  let request = SiriToolsGenerated.Request(
79
82
  method: ${swiftString(tool.request.method)},
80
83
  url: ${swiftString(tool.request.url)},
@@ -84,7 +87,7 @@ ${tool.parameters.map((parameter) => parameterSwift(tool, parameter)).join('')}
84
87
  let answer = await SiriToolsGenerated.tool.answer {
85
88
  try SiriToolsGenerated.reply(${swiftString(tool.reply)}, from: try await request.send())
86
89
  }
87
- return .result(value: answer, dialog: "\\(answer)")
90
+ return .result(value: answer${tool.returns === 'dialog' ? ', dialog: "\\(answer)"' : ''})
88
91
  }
89
92
  }
90
93
  ${enums.join('')}#endif
@@ -25,9 +25,12 @@ npx expo install expo-syrup-ai-kit expo-app-intents
25
25
  ```
26
26
 
27
27
  ```bash
28
- SIRI_AI_PREVIEW=1 npx expo prebuild -p ios
28
+ npx expo-app-intents init --examples minimal # unless app-intents/AppIntentsSetup.swift exists
29
+ SIRI_AI_PREVIEW=1 CP_CACHE_DIR="$PWD/.cp-cache" LANG=en_US.UTF-8 npx expo prebuild -p ios
29
30
  ```
30
31
 
32
+ `init` creates the `AppIntentsSetup` inline module and turns on inline modules in `app.json`. `npx expo install` adds both plugins; keep `expo-app-intents` first, as above.
33
+
31
34
  With the preview on, the plugin adds the `SIRI_AI_PREVIEW` Swift condition and sets the **app target** to iOS 27.3. Without `SIRI_AI_PREVIEW=1` (or `["expo-syrup-ai-kit", { "preview": true }]`), tool code inside `#if SIRI_AI_PREVIEW` doesn't compile in, and Siri never sees the tool.
32
35
 
33
36
  Options: `version` (SyrupAIKit release, up to next minor; defaults to the tested one), `branch` (unreleased SyrupAIKit; not with `version`), `preview`, `evals`, `skills` (`{ "sourceDir": "siri-skills" }`: a folder of Apple App Skills, one folder per skill with only a `SKILL.md`; checked at prebuild and compiled into the app as `Skills.skillsbundle`).
@@ -40,7 +43,7 @@ Don't add the Siri Evaluations UI test target in Xcode: `prebuild --clean` drops
40
43
  ["expo-syrup-ai-kit", { "preview": true, "evals": { "sourceDir": "siri-evals" } }]
41
44
  ```
42
45
 
43
- Prebuild then adds a `<AppName>Evals` UI test target (rename with `targetName`) that compiles every `.swift` file under `siri-evals/`, tests the app, builds for iOS 27.3, links `SyrupAIEvalKit` from the same package, and has a shared scheme of the same name: `xcodebuild test -workspace ios/<App>.xcworkspace -scheme <App>Evals -destination 'platform=iOS,name=<device>'`. Prebuild again after adding or removing a test file.
46
+ Prebuild then adds a `<AppName>Evals` UI test target (rename with `targetName`) that compiles every `.swift` file under `siri-evals/`, tests the app, builds for iOS 27.3, links `SyrupAIEvalKit` from the same package, and has a shared scheme of the same name: `xcodebuild test -workspace ios/<App>.xcworkspace -scheme <App>Evals -configuration Release -destination 'platform=iOS,name=<device>'`. Use Release: a Debug build loads its JavaScript from the dev server and won't start without `npx expo start`. Prebuild again after adding or removing a test file.
44
47
 
45
48
  ## The tool lives in `app-intents/`
46
49
 
@@ -66,6 +69,8 @@ struct GetOrderStatusIntent: AppIntent {
66
69
 
67
70
  The Swift tool can't call your JavaScript API client or read JS memory. It needs its own Swift request code.
68
71
 
72
+ The dialog makes Siri say the answer word for word and end its turn. If an App Skill names the tool, or Siri should combine it with others, return `some IntentResult & ReturnsValue<String>` and `.result(value: answer)` instead; a generated tool does this with `"returns": "value"`.
73
+
69
74
  ## Implementing tools from `siri-tools.json`
70
75
 
71
76
  A `siri-tools.json` from the siri-ai-discover skill is the tools' interface. Each entry has `name`, `title`, `description` and `parameters`, and usually `"javascript": "<handler>"`. Implement every entry with that interface unchanged: evaluations check `name`, and Siri chooses tools by `description`.
@@ -73,6 +78,7 @@ A `siri-tools.json` from the siri-ai-discover skill is the tools' interface. Eac
73
78
  | The entry has | Do this today |
74
79
  |---|---|
75
80
  | `javascript` | Not supported yet: the plugin rejects it as an unknown field. Write a Swift tool in `app-intents/` named `<name>Intent`, copy `title` and `description` word for word, and add one `@Parameter(title:description:)` per declared parameter, with its `title` and `description`. Keep the entry as the tool's spec, but leave it out of the `tools` file until the `javascript` kind ships. |
81
+ | `returns: "value"` | In Swift, return `.result(value: answer)` without `ProvidesDialog`. A generated tool does it for you. |
76
82
  | `request` and `reply` | Generated at prebuild by the `tools` option (experimental). Use it only when the host is fixed and `https`, the API needs no credentials, and every reply field is always present. Generated tools send plain requests, and any non-2xx response is a failure. Otherwise write Swift. |
77
83
 
78
84
  Discovery also writes a handler stub and a failing test per tool in `src/siri-tools/<handler>.ts` (or `siri-tools/` without `src/`). Discovery offers to implement it, and to write the Swift tool; if the owner declined, implement the handler against the test now: it's plain TypeScript that calls the app's own functions, never hooks. It answers Siri once the `javascript` kind ships; until then the Swift tool is what answers.
@@ -84,6 +90,7 @@ Whatever the kind, the answer is one sentence (the count and at most three names
84
90
  The screen is React Native, so use a JS `<Text>` instead of SyrupAIKit's SwiftUI `ToolOutcomeView`. Expose the outcome from the `AppIntentsSetup` inline module that expo-app-intents uses (`app-intents/AppIntentsSetup.swift`; keep the class name):
85
91
 
86
92
  ```swift
93
+ internal import ExpoAppIntents
87
94
  internal import ExpoModulesCore
88
95
  import SyrupAIKit
89
96
 
@@ -106,18 +113,21 @@ export function SiriToolOutcome() {
106
113
  const poll = setInterval(() => setOutcome(Setup.siriToolOutcome()), 1000);
107
114
  return () => clearInterval(poll);
108
115
  }, []);
109
- return __DEV__ ? <Text testID="siri-ai-tool-outcome">{outcome}</Text> : null;
116
+ return <Text testID="siri-ai-tool-outcome">{outcome}</Text>;
110
117
  }
111
118
  ```
112
119
 
113
- Render `<SiriToolOutcome />` on a screen that's always visible. The testID `siri-ai-tool-outcome` is what SyrupAIEvalKit reads. If the module already exists, add the `Function` to it rather than creating a second one.
120
+ Render `<SiriToolOutcome />` on a screen that's always visible. The testID `siri-ai-tool-outcome` is what SyrupAIEvalKit reads. Don't hide it behind `__DEV__`: evaluations run a Release build, so the outcome would never show. If the module already exists, add the `Function` to it rather than creating a second one. Import `SyrupAIKit` the same way in every file in `app-intents/`: plain `import SyrupAIKit` here and in the tools.
114
121
 
115
122
  ## Prebuild and build traps
116
123
 
117
124
  | Symptom | Fix |
118
125
  |---|---|
119
126
  | CocoaPods: `Unicode Normalization not appropriate for ASCII-8BIT` | Run with `LANG=en_US.UTF-8` |
120
- | `hermesvm.xcframework/Info.plist` missing during `pod install` | A broken CocoaPods cache, unrelated to SyrupAIKit: `cd ios && CP_CACHE_DIR="$PWD/../.cp-cache" LANG=en_US.UTF-8 pod install` |
127
+ | `pod install`: `Info.plist` missing in `hermesvm.xcframework` or `React-Core-prebuilt/React.xcframework` | A broken CocoaPods cache, unrelated to SyrupAIKit: `cd ios && CP_CACHE_DIR="$PWD/../.cp-cache" LANG=en_US.UTF-8 pod install` |
128
+ | `ambiguous implicit access level for import of 'SyrupAIKit'` | One file in `app-intents/` has `internal import SyrupAIKit` and another plain `import SyrupAIKit`. Use one form in every file |
129
+ | No `app-intents/AppIntentsSetup.swift` to add the outcome function to | Run `npx expo-app-intents init --examples minimal`, then prebuild again |
130
+ | Evaluations run a Debug build | Debug loads JavaScript from the dev server, so the app needs `npx expo start` running. Use `-configuration Release` |
121
131
  | `No such module 'SyrupAIKit'` in `app-intents/` | Plugin missing from `app.json`, or prebuild not re-run after adding it |
122
132
  | Siri never calls the tool, no build error | Prebuilt without `SIRI_AI_PREVIEW=1`, so `@AppIntent(.tool)` compiled out |
123
133
  | Evaluation UI test target gone | Set the plugin's `evals: { "sourceDir": "siri-evals" }` option instead of adding the target in Xcode, then prebuild again |
@@ -83,6 +83,8 @@ Propose an App Skill only when all of these hold:
83
83
  - **Every step is a tool on the shortlist.** If a step needs a tool the app lacks, or a tool's answer leaves out what the next step needs (a spoken answer that says "and 9 more"), don't draft the skill. List it as a gap with the tool change it would need; that change is the owner's call.
84
84
  - **A single tool doesn't already answer it.** One question or one action needs no skill.
85
85
 
86
+ Every tool a kept skill names gets `"returns": "value"` in `siri-tools.json`. A tool that returns a spoken dialog ends Siri's turn, so Siri can't chain it.
87
+
86
88
  Draft at most two or three. A skill for every pair of tools is noise Siri has to read.
87
89
 
88
90
 
@@ -118,6 +120,7 @@ One entry per kept tool, in the owner's order:
118
120
  - `name` is PascalCase, unique, and doesn't end in `Intent`. Evaluations use it to check which tool Siri called.
119
121
  - `description` says what the tool returns, in the user's own words. Siri reads it to choose the tool.
120
122
  - Each parameter has `name`, `type`, `title` and `description`. The type is one of `string`, `int`, `double`, `bool`, `date` or `enum` (with `cases`). The `description` is one line saying what the person gives, with an example value: "The product to add, as the person names it, like 'oat milk'." Siri reads it to fill the parameter from what was said.
123
+ - `returns` is `"value"` for a tool any App Skill names, or that people combine with other tools in one request. Leave it out otherwise: Siri then says the tool's answer word for word.
121
124
  - `javascript` is the handler's name and its file name: `name` in kebab-case, dropping a leading `Get` (`GetUnreadNotifications` → `unread-notifications`, `PostMessage` → `post-message`). The handler function is the camelCase of the same words (`unreadNotifications`).
122
125
 
123
126
  ### One handler file per tool
@@ -225,6 +228,7 @@ These hold at the end of step 4, before you offer step 5.
225
228
  - Every parameter appears in the spoken prompt, and nothing the prompt needs is missing.
226
229
  - Every parameter has a one-line `description` with an example value.
227
230
  - Two descriptions aren't easy to confuse.
231
+ - Every tool an App Skill names has `"returns": "value"`.
228
232
  - Every App Skill's steps name only tools in `siri-tools.json`, its `name` matches its folder, and its frontmatter has only `name` and `description`.
229
233
  - No existing app file changed, `app.json` included.
230
234
  - You ran the new tests with the app's own test command. Each test fails on the stub's "not implemented" error, not on loading the test. If the tests can't run (no `node_modules`, wrong Node version), say so in the report; never install anything to make them run.