@scarn/sdk 0.8.7 → 0.8.8

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.
@@ -1414,7 +1414,7 @@ var grantActionValues = [
1414
1414
  "close",
1415
1415
  "create"
1416
1416
  ];
1417
- var grantScopeValues = ["self", "children"];
1417
+ var grantScopeValues = ["self", "children", "project"];
1418
1418
  var notificationKindSchema = exports_external.enum([
1419
1419
  "feedback_request",
1420
1420
  "status_update",
@@ -1502,14 +1502,16 @@ var WORK_ITEM_ACTION_TEXT = {
1502
1502
  close: "close",
1503
1503
  create: "create"
1504
1504
  };
1505
- var scopeText = (action, scope) => {
1506
- if (action === "create")
1507
- return "child work items of your work item";
1508
- return scope === "self" ? "your work item" : "its child work items";
1505
+ var SCOPE_TEXT = {
1506
+ self: "your work item",
1507
+ children: "its child work items",
1508
+ project: "any work item in this project (pass its `workItemId`)"
1509
1509
  };
1510
+ var scopeText = (action, scope) => action === "create" ? "child work items of your work item" : SCOPE_TEXT[scope];
1510
1511
  var scopeHeading = {
1511
1512
  self: "Your Work Item",
1512
- children: "Child Work Items"
1513
+ children: "Child Work Items",
1514
+ project: "Any Work Item in the Project"
1513
1515
  };
1514
1516
  var actionHeading = {
1515
1517
  read: "Read",
@@ -274,8 +274,8 @@ export declare const automationDocumentSchema: z.ZodObject<{
274
274
  key: z.ZodString;
275
275
  title: z.ZodOptional<z.ZodString>;
276
276
  scope: z.ZodEnum<{
277
- workItem: "workItem";
278
277
  project: "project";
278
+ workItem: "workItem";
279
279
  }>;
280
280
  rules: z.ZodArray<z.ZodObject<{
281
281
  event: z.ZodEnum<{
@@ -33,7 +33,7 @@ import {
33
33
  resolveMcpChecks,
34
34
  toStepHandle,
35
35
  toStepSpec
36
- } from "../../chunk-jjpc2chg.js";
36
+ } from "../../chunk-y2s9kpfp.js";
37
37
  import"../../chunk-e1h021kq.js";
38
38
  import"../../chunk-63f90zky.js";
39
39
  import"../../chunk-jj9pezwb.js";
@@ -35,7 +35,7 @@ declare const buildStepDefinitionsClient: (stepDefinitions: StepDefinitions) =>
35
35
  grants: Array<{
36
36
  resource: string;
37
37
  action: string;
38
- scope: "self" | "children";
38
+ scope: "self" | "children" | "project";
39
39
  } | {
40
40
  resource: string;
41
41
  action: string;
@@ -197,7 +197,7 @@ declare const buildStepDefinitionsClient: (stepDefinitions: StepDefinitions) =>
197
197
  grants: Array<{
198
198
  resource: string;
199
199
  action: string;
200
- scope: "self" | "children";
200
+ scope: "self" | "children" | "project";
201
201
  } | {
202
202
  resource: string;
203
203
  action: string;
@@ -369,7 +369,7 @@ declare const buildStepDefinitionsClient: (stepDefinitions: StepDefinitions) =>
369
369
  grants: Array<{
370
370
  resource: string;
371
371
  action: string;
372
- scope: "self" | "children";
372
+ scope: "self" | "children" | "project";
373
373
  } | {
374
374
  resource: string;
375
375
  action: string;
@@ -1,23 +1,33 @@
1
1
  import { z } from "zod";
2
2
  import type { ZodObject, ZodRawShape } from "zod";
3
3
  export declare const grantActionValues: readonly ["read", "update", "comment", "label", "block", "close", "create"];
4
- export declare const grantScopeValues: readonly ["self", "children"];
4
+ export declare const grantScopeValues: readonly ["self", "children", "project"];
5
5
  /** What a grant lets the agent do to a work item. */
6
6
  export type GrantAction = (typeof grantActionValues)[number];
7
- /** `self`: the Task's own work item. `children`: its child work items. */
7
+ /**
8
+ * `self`: the Task's own work item. `children`: its child work items.
9
+ * `project`: any work item in the project (`read` only).
10
+ */
8
11
  export type GrantScope = (typeof grantScopeValues)[number];
12
+ /** The scopes a grant that changes work items may cover. */
13
+ export type ChangeGrantScope = Exclude<GrantScope, "project">;
9
14
  /**
10
15
  * One thing a step's Tasks may do to a work item. `label` and `create` name
11
- * the labels they may set; `create` only covers `children`.
16
+ * the labels they may set; `create` only covers `children`; only `read` may
17
+ * cover `project`.
12
18
  */
13
19
  export type Grant = {
14
20
  resource: "workItem";
15
- action: "read" | "update" | "comment" | "block" | "close";
21
+ action: "read";
16
22
  scope: GrantScope;
23
+ } | {
24
+ resource: "workItem";
25
+ action: "update" | "comment" | "block" | "close";
26
+ scope: ChangeGrantScope;
17
27
  } | {
18
28
  resource: "workItem";
19
29
  action: "label";
20
- scope: GrantScope;
30
+ scope: ChangeGrantScope;
21
31
  labels: string[];
22
32
  } | {
23
33
  resource: "workItem";
@@ -113,10 +123,10 @@ export type FeedbackRequestItem = {
113
123
  urgency: FeedbackRequestUrgency;
114
124
  };
115
125
  type ScopeOptions = {
116
- scope: GrantScope;
126
+ scope: ChangeGrantScope;
117
127
  };
118
128
  type LabelsOptions<TLabels extends readonly string[]> = {
119
- scope: GrantScope;
129
+ scope: ChangeGrantScope;
120
130
  labels: TLabels;
121
131
  };
122
132
  export declare const Features: {
@@ -129,30 +139,32 @@ export declare const Features: {
129
139
  */
130
140
  readonly feedbackRequests: () => NotificationsFeature;
131
141
  readonly workItems: {
132
- readonly read: ({ scope }: ScopeOptions) => WorkItemFeature<{
142
+ readonly read: ({ scope }: {
143
+ scope: GrantScope;
144
+ }) => WorkItemFeature<{
133
145
  readonly resource: "workItem";
134
146
  readonly action: "read";
135
- readonly scope: "self" | "children";
147
+ readonly scope: "self" | "children" | "project";
136
148
  }>;
137
149
  readonly update: ({ scope }: ScopeOptions) => WorkItemFeature<{
138
150
  readonly resource: "workItem";
139
151
  readonly action: "update";
140
- readonly scope: "self" | "children";
152
+ readonly scope: ChangeGrantScope;
141
153
  }>;
142
154
  readonly comment: ({ scope }: ScopeOptions) => WorkItemFeature<{
143
155
  readonly resource: "workItem";
144
156
  readonly action: "comment";
145
- readonly scope: "self" | "children";
157
+ readonly scope: ChangeGrantScope;
146
158
  }>;
147
159
  readonly block: ({ scope }: ScopeOptions) => WorkItemFeature<{
148
160
  readonly resource: "workItem";
149
161
  readonly action: "block";
150
- readonly scope: "self" | "children";
162
+ readonly scope: ChangeGrantScope;
151
163
  }>;
152
164
  readonly close: ({ scope }: ScopeOptions) => WorkItemFeature<{
153
165
  readonly resource: "workItem";
154
166
  readonly action: "close";
155
- readonly scope: "self" | "children";
167
+ readonly scope: ChangeGrantScope;
156
168
  }>;
157
169
  /** Add or remove the given labels; the agent may not touch any other. */
158
170
  readonly label: <const TLabels extends readonly [string, ...string[]]>({ scope, labels, }: LabelsOptions<TLabels>) => WorkItemFeature<Extract<Grant, {
@@ -1503,7 +1503,7 @@ export type GetApiStepDefinitionsResponses = {
1503
1503
  grants: Array<{
1504
1504
  resource: string;
1505
1505
  action: string;
1506
- scope: 'self' | 'children';
1506
+ scope: 'self' | 'children' | 'project';
1507
1507
  } | {
1508
1508
  resource: string;
1509
1509
  action: string;
@@ -1667,7 +1667,7 @@ export type PostApiStepDefinitionsData = {
1667
1667
  grants?: Array<{
1668
1668
  resource: string;
1669
1669
  action: string;
1670
- scope: 'self' | 'children';
1670
+ scope: 'self' | 'children' | 'project';
1671
1671
  } | {
1672
1672
  resource: string;
1673
1673
  action: string;
@@ -1971,7 +1971,7 @@ export type PostApiStepDefinitionsResponses = {
1971
1971
  grants: Array<{
1972
1972
  resource: string;
1973
1973
  action: string;
1974
- scope: 'self' | 'children';
1974
+ scope: 'self' | 'children' | 'project';
1975
1975
  } | {
1976
1976
  resource: string;
1977
1977
  action: string;
@@ -2135,7 +2135,7 @@ export type PutApiStepDefinitionsData = {
2135
2135
  grants?: Array<{
2136
2136
  resource: string;
2137
2137
  action: string;
2138
- scope: 'self' | 'children';
2138
+ scope: 'self' | 'children' | 'project';
2139
2139
  } | {
2140
2140
  resource: string;
2141
2141
  action: string;
@@ -2401,7 +2401,7 @@ export type PutApiStepDefinitionsResponses = {
2401
2401
  grants: Array<{
2402
2402
  resource: string;
2403
2403
  action: string;
2404
- scope: 'self' | 'children';
2404
+ scope: 'self' | 'children' | 'project';
2405
2405
  } | {
2406
2406
  resource: string;
2407
2407
  action: string;
@@ -2675,7 +2675,7 @@ export type GetApiStepDefinitionsByStepDefinitionIdResponses = {
2675
2675
  grants: Array<{
2676
2676
  resource: string;
2677
2677
  action: string;
2678
- scope: 'self' | 'children';
2678
+ scope: 'self' | 'children' | 'project';
2679
2679
  } | {
2680
2680
  resource: string;
2681
2681
  action: string;
@@ -2949,7 +2949,7 @@ export type PutApiStepDefinitionsByStepDefinitionIdArchiveResponses = {
2949
2949
  grants: Array<{
2950
2950
  resource: string;
2951
2951
  action: string;
2952
- scope: 'self' | 'children';
2952
+ scope: 'self' | 'children' | 'project';
2953
2953
  } | {
2954
2954
  resource: string;
2955
2955
  action: string;
@@ -3259,7 +3259,7 @@ export type PostApiTasksResponses = {
3259
3259
  grants: Array<{
3260
3260
  resource: string;
3261
3261
  action: string;
3262
- scope: 'self' | 'children';
3262
+ scope: 'self' | 'children' | 'project';
3263
3263
  } | {
3264
3264
  resource: string;
3265
3265
  action: string;
@@ -3570,7 +3570,7 @@ export type GetApiTasksByTaskIdResponses = {
3570
3570
  grants: Array<{
3571
3571
  resource: string;
3572
3572
  action: string;
3573
- scope: 'self' | 'children';
3573
+ scope: 'self' | 'children' | 'project';
3574
3574
  } | {
3575
3575
  resource: string;
3576
3576
  action: string;
@@ -4454,7 +4454,7 @@ export type PostApiTaskRunsByTaskRunIdWorkerContextResponses = {
4454
4454
  grants: Array<{
4455
4455
  resource: string;
4456
4456
  action: string;
4457
- scope: 'self' | 'children';
4457
+ scope: 'self' | 'children' | 'project';
4458
4458
  } | {
4459
4459
  resource: string;
4460
4460
  action: string;
package/dist/index.js CHANGED
@@ -99,7 +99,7 @@ import {
99
99
  resolveMcpChecks,
100
100
  toStepHandle,
101
101
  toStepSpec
102
- } from "./chunk-jjpc2chg.js";
102
+ } from "./chunk-y2s9kpfp.js";
103
103
  import {
104
104
  collectEnvPlaceholderNames,
105
105
  isEnvPlaceholderValue,
@@ -17,7 +17,7 @@ import {
17
17
  import {
18
18
  createStepDefinitionsClient,
19
19
  toStepSpec
20
- } from "../chunk-jjpc2chg.js";
20
+ } from "../chunk-y2s9kpfp.js";
21
21
  import"../chunk-e1h021kq.js";
22
22
  import"../chunk-63f90zky.js";
23
23
  import"../chunk-jj9pezwb.js";
@@ -332,7 +332,7 @@ declare const buildTaskPlaneClient: (taskRuns: TaskRuns) => {
332
332
  grants: Array<{
333
333
  resource: string;
334
334
  action: string;
335
- scope: "self" | "children";
335
+ scope: "self" | "children" | "project";
336
336
  } | {
337
337
  resource: string;
338
338
  action: string;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
3
  "name": "@scarn/sdk",
4
- "version": "0.8.7",
4
+ "version": "0.8.8",
5
5
  "type": "module",
6
6
  "exports": {
7
7
  ".": {