@uniformdev/automations-sdk 20.74.7-alpha.3 → 20.75.0

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.
@@ -33,6 +33,11 @@ interface ScoutClientOptions extends ClientOptions {
33
33
  * @default 'https://ai.uniform.global'
34
34
  */
35
35
  aiApiHost?: string;
36
+ /**
37
+ * Default release for every turn this client invokes. See {@link ScoutInvokeParamsCommon.releaseId};
38
+ * a `releaseId` passed to {@link ScoutClient.invoke} overrides this for that turn.
39
+ */
40
+ releaseId?: string;
36
41
  }
37
42
  /** Shared invoke parameters. */
38
43
  interface ScoutInvokeParamsCommon {
@@ -46,6 +51,23 @@ interface ScoutInvokeParamsCommon {
46
51
  * text part.
47
52
  */
48
53
  message: string | ScoutInvokeMessage;
54
+ /**
55
+ * Release to work in for this turn. Content Scout reads is the release's version, and content it
56
+ * edits is staged in the release instead of base — the same behavior an author gets when editing
57
+ * inside a release in the dashboard. Omit to work on base.
58
+ *
59
+ * When reacting to a release-scoped event, pass the release id from the trigger payload. This
60
+ * seeds the turn; Scout can move off it with `setCurrentRelease` if the task calls for a different
61
+ * release, but it can never invent one — that tool validates the id before any write happens.
62
+ *
63
+ * Must be an *open* release; a save into a locked, launching, or launched release is refused.
64
+ * Assets are not part of releases and cannot be modified while this is set.
65
+ *
66
+ * On a continued thread, a release set on an earlier turn stays in effect: context is merged
67
+ * across the thread's messages, so omitting this does not reset the thread to base. Use
68
+ * `setCurrentRelease` from within the conversation to go back to base.
69
+ */
70
+ releaseId?: string;
49
71
  }
50
72
  /** Parameters for a Scout invocation. */
51
73
  interface ScoutInvokeParams<S extends ScoutOutputSchema = ScoutOutputSchema> extends ScoutInvokeParamsCommon {
package/dist/ai/index.mjs CHANGED
@@ -40,9 +40,13 @@ var ScoutClient = class extends ApiClient {
40
40
  __privateSet(this, _aiApiHost, ((_a = options.aiApiHost) != null ? _a : DEFAULT_AI_HOST).replace(/\/+$/, ""));
41
41
  }
42
42
  async invoke(params) {
43
- var _a;
43
+ var _a, _b;
44
44
  const threadId = (_a = params.threadId) != null ? _a : crypto.randomUUID();
45
- const messages = [normalizeInvokeMessage(params.message)];
45
+ const messages = [
46
+ withInvocationContext(normalizeInvokeMessage(params.message), {
47
+ releaseId: (_b = params.releaseId) != null ? _b : this.options.releaseId
48
+ })
49
+ ];
46
50
  const outputSchema = params.outputSchema ? toOutputJsonSchema(params.outputSchema) : void 0;
47
51
  const result = await this.apiClient(
48
52
  new URL(__privateMethod(this, _ScoutClient_instances, endpoint_fn).call(this, threadId)),
@@ -104,6 +108,18 @@ function normalizeInvokeMessage(message) {
104
108
  }
105
109
  return { ...message, id: (_a = message.id) != null ? _a : crypto.randomUUID() };
106
110
  }
111
+ function withInvocationContext(message, context) {
112
+ if (!context.releaseId) {
113
+ return message;
114
+ }
115
+ return {
116
+ ...message,
117
+ metadata: {
118
+ ...typeof message.metadata === "object" && message.metadata !== null ? message.metadata : {},
119
+ invocationContextChanges: { releaseId: context.releaseId }
120
+ }
121
+ };
122
+ }
107
123
  export {
108
124
  ScoutClient
109
125
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniformdev/automations-sdk",
3
- "version": "20.74.7-alpha.3+f1d91835fc",
3
+ "version": "20.75.0",
4
4
  "description": "Uniform Automations SDK",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "exports": {
@@ -40,8 +40,8 @@
40
40
  ],
41
41
  "dependencies": {
42
42
  "@standard-schema/spec": "^1.1.0",
43
- "@uniformdev/context": "20.74.7-alpha.3+f1d91835fc",
44
- "@uniformdev/webhooks": "20.74.7-alpha.3+f1d91835fc"
43
+ "@uniformdev/context": "20.75.0",
44
+ "@uniformdev/webhooks": "20.75.0"
45
45
  },
46
46
  "peerDependencies": {
47
47
  "ai": "^6.0.0",
@@ -62,5 +62,5 @@
62
62
  "publishConfig": {
63
63
  "access": "public"
64
64
  },
65
- "gitHead": "f1d91835fca9645311dde0f546008b1bfc98fbdf"
65
+ "gitHead": "945b06786c480e1595d06bfc51f539ddcf15f7c5"
66
66
  }