@kana-ai/edgar-ext-slack 0.1.3 → 0.1.5

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.
@@ -5,20 +5,31 @@ export const slackOrigin = z.object({
5
5
  channel: z.string().min(1),
6
6
  thread: z.string().min(1),
7
7
  });
8
- /** What started a run, from its `run_created` payload: `subrun:<parent>:<pass>` for a run that a stage of another run started, who the run's card is assigned to, as the tracker names them, its workflow, and the place of the words a service relayed to start it. */
8
+ /** What started a run, from its `run_created` payload: `subrun:<parent>:<pass>` for a run that a stage of another run started, who the run's card is assigned to, as the tracker names them, who asked for the work, by name and by their id in the service that opened the card for them, what the card asks, its workflow, and the place of the words a service relayed to start it. */
9
9
  export const runTrigger = z.looseObject({
10
10
  trigger_key: z.string().optional(),
11
11
  assignee: z.string().min(1).optional(),
12
+ requested_by: z.string().min(1).optional(),
13
+ requested_by_id: z.string().min(1).optional(),
14
+ ask: z.string().min(1).optional(),
12
15
  workflow: z.string().min(1).optional(),
13
16
  relayed: z.unknown().optional(),
14
17
  });
15
- /** The answer a done stage gave a person: an `attempt_outcome` payload whose output has a `text`, as the built-in `schemas/answer.json` makes it. */
18
+ /** The answer a done stage gave a person: an `attempt_outcome` payload whose output has a `text`, with the `sources` it rests on and whether it is `confident`, as the built-in `schemas/answer.json` makes it. A source or a flag of another shape is left out, so the answer still goes. */
16
19
  export const answerOutcome = z.looseObject({
17
20
  outcome: z.looseObject({
18
21
  outcome: z.literal("done"),
19
- output: z.looseObject({ text: z.string().min(1) }),
22
+ output: z.looseObject({
23
+ text: z.string().min(1),
24
+ sources: z.array(z.string()).optional().catch(undefined),
25
+ confident: z.boolean().optional().catch(undefined),
26
+ }),
20
27
  }),
21
28
  });
29
+ /** The output of a stage, as far as the words a person reads of it go: an `attempt_outcome` payload whose output is an object. */
30
+ export const outputOutcome = z.looseObject({
31
+ outcome: z.looseObject({ output: z.record(z.string(), z.unknown()) }),
32
+ });
22
33
  /** The card a done stage of a run with no card opened: an `attempt_outcome` payload whose output is the `id` that `tracker__create_card` gives. */
23
34
  export const openedOutcome = z.looseObject({
24
35
  outcome: z.looseObject({
@@ -33,6 +44,28 @@ export const questionOutcome = z.looseObject({
33
44
  output: z.looseObject({ question: z.string().trim().min(1) }),
34
45
  }),
35
46
  });
47
+ /** A person a run names: their id in a service, such as `github`, `linear` or `slack`, their `email` or their `name`, and `why`. The engine adds the Slack id and the email of the person of `[people]` that one of these matches. */
48
+ export const reachable = z.record(z.string(), z.string());
49
+ /** The people that a done stage named as able to act on its question: the `who_can_act` of its output, none when it has none or they do not read. */
50
+ export const actorsOutcome = z.looseObject({
51
+ outcome: z.looseObject({
52
+ output: z.looseObject({ who_can_act: z.array(reachable).catch([]) }),
53
+ }),
54
+ });
55
+ /** Who asked for the work, from a `run_created` payload: by name and by their id in the service that opened the card, with the engine's match in `[people]` as `requester`. */
56
+ export const runRequester = z.looseObject({
57
+ requested_by: z.string().min(1).optional(),
58
+ requested_by_id: z.string().min(1).optional(),
59
+ requester: reachable.optional().catch(undefined),
60
+ });
61
+ /** What the end of a run says of its question: the question, the people its newest output named as able to act, and when the run began, in Unix milliseconds, from a `run_outcome` payload. */
62
+ export const endActors = z.looseObject({
63
+ end: z.looseObject({
64
+ question: z.string().optional(),
65
+ started: z.number().optional(),
66
+ who_can_act: z.array(reachable).catch([]),
67
+ }),
68
+ });
36
69
  /** A done stage whose output names the chat channel that a person asked to get the result in: the `post_in` of a classification. */
37
70
  export const postOutcome = z.looseObject({
38
71
  outcome: z.looseObject({
@@ -64,11 +97,38 @@ export const reviewOutcome = z.looseObject({
64
97
  /** The outcome word of an `attempt_outcome` or `run_outcome` payload. */
65
98
  export const outcomeRecord = z.looseObject({ outcome: z.looseObject({ outcome: z.string() }) });
66
99
  /** The first message of a card's thread: the card's link and the runs whose messages go in the thread, newest last. */
67
- export const cardRoot = z.looseObject({ card: z.string(), runs: z.array(z.string()) });
68
- /** The part of an `approval_requested` payload the question reads. `assignee` is who the run's card is assigned to, as the tracker names them. */
100
+ export const cardRoot = z.looseObject({
101
+ card: z.string(),
102
+ title: z.string().optional(),
103
+ runs: z.array(z.string()),
104
+ });
105
+ /** The person of `[people]` whose own key or subscription a run ran on, from the `end` of its `run_outcome`: their name, the kind of credential, the provider, and the Slack id and email that the engine found for them. */
106
+ export const endPaid = z.looseObject({
107
+ end: z.looseObject({
108
+ paid_by: z.looseObject({
109
+ name: z.string().min(1),
110
+ credential: z.string(),
111
+ provider: z.string().min(1).optional(),
112
+ slack: z.string().optional(),
113
+ email: z.string().optional(),
114
+ }),
115
+ }),
116
+ });
117
+ /** What a card's first message shows besides the card, kept in its metadata so a change of one part keeps the others: the status of the card's newest run, what the card asks, who asked for the work and who holds the card, each as Slack writes them, whose own key or subscription the run ran on (`paid`) and what it was (`paid_with`), such as "Claude subscription", and the pull requests to open. */
118
+ export const rootView = z.object({
119
+ status: z.string().optional(),
120
+ ask: z.string().optional(),
121
+ by: z.string().optional(),
122
+ paid: z.string().optional(),
123
+ paid_with: z.string().optional(),
124
+ holder: z.string().optional(),
125
+ pulls: z.array(z.object({ url: z.string(), label: z.string() })).optional(),
126
+ });
127
+ /** The part of an `approval_requested` payload the question reads. `policy` is how often the project asks, and `assignee` is who the run's card is assigned to, as the tracker names them. */
69
128
  export const approvalRequested = z.looseObject({
70
129
  operation_id: z.string().min(1),
71
130
  tool: z.string().min(1),
131
+ policy: z.string().optional().catch(undefined),
72
132
  input: z.unknown().optional(),
73
133
  assignee: z.string().min(1).optional(),
74
134
  });
@@ -80,11 +140,11 @@ export const waitingForSlot = z.looseObject({
80
140
  });
81
141
  /** The state of one stage on the plan message. */
82
142
  export const taskState = z.enum(["working", "done", "failed", "waiting"]);
83
- /** The plan of one run, kept in its message's metadata so each event updates it in place: the run's card as the line that links it, what the run waits on while it is queued, each stage that started in the order of its start, each pull request a stage opened, and the outcome word once the run is over. A stage that read what people decided on the pull request has that as its `label`. */
143
+ /** The plan of one run, kept in its message's metadata so each event updates it in place: the run's card as the line that links it, what the run waits on while it is queued with the run's workflow, each stage that started in the order of its start, each pull request a stage opened, and the outcome word once the run is over. A stage that read what people decided on the pull request has that as its `label`. */
84
144
  export const planState = z.object({
85
145
  run: z.string(),
86
146
  card: z.string().optional(),
87
- queued: waitingForSlot.optional(),
147
+ queued: waitingForSlot.extend({ workflow: z.string().optional() }).optional(),
88
148
  tasks: z.array(z.object({ stage: z.string(), state: taskState, label: z.string().optional() })),
89
149
  pulls: z.array(z.object({ url: z.string(), label: z.string() })).default([]),
90
150
  ended: z.string().optional(),
@@ -36,6 +36,7 @@ export declare const userInfo: z.ZodObject<{
36
36
  }, z.core.$loose>>;
37
37
  profile: z.ZodOptional<z.ZodObject<{
38
38
  email: z.ZodOptional<z.ZodString>;
39
+ display_name: z.ZodOptional<z.ZodString>;
39
40
  }, z.core.$loose>>;
40
41
  }, z.core.$loose>;
41
42
  }, z.core.$loose>;
@@ -138,7 +139,14 @@ export declare const stopped: z.ZodObject<{
138
139
  thread_ts: z.ZodString;
139
140
  user: z.ZodString;
140
141
  }, z.core.$loose>;
141
- /** A press on one of EDGAR's buttons. */
142
+ /** One block of a message, as far as a press reads it: its type, and the id of each element of an `actions` block. */
143
+ export declare const block: z.ZodObject<{
144
+ type: z.ZodString;
145
+ elements: z.ZodOptional<z.ZodArray<z.ZodObject<{
146
+ action_id: z.ZodOptional<z.ZodString>;
147
+ }, z.core.$loose>>>;
148
+ }, z.core.$loose>;
149
+ /** A press on one of EDGAR's buttons, with the text and the blocks of the message that holds the button. */
142
150
  export declare const pressed: z.ZodObject<{
143
151
  type: z.ZodLiteral<"block_actions">;
144
152
  user: z.ZodObject<{
@@ -150,6 +158,13 @@ export declare const pressed: z.ZodObject<{
150
158
  message: z.ZodOptional<z.ZodObject<{
151
159
  ts: z.ZodString;
152
160
  thread_ts: z.ZodOptional<z.ZodString>;
161
+ text: z.ZodOptional<z.ZodString>;
162
+ blocks: z.ZodOptional<z.ZodArray<z.ZodObject<{
163
+ type: z.ZodString;
164
+ elements: z.ZodOptional<z.ZodArray<z.ZodObject<{
165
+ action_id: z.ZodOptional<z.ZodString>;
166
+ }, z.core.$loose>>>;
167
+ }, z.core.$loose>>>;
153
168
  }, z.core.$loose>>;
154
169
  actions: z.ZodArray<z.ZodObject<{
155
170
  action_id: z.ZodString;
@@ -23,7 +23,9 @@ export const userInfo = z.looseObject({
23
23
  is_ultra_restricted: z.boolean().optional(),
24
24
  is_stranger: z.boolean().optional(),
25
25
  enterprise_user: z.looseObject({ enterprise_id: z.string().optional() }).optional(),
26
- profile: z.looseObject({ email: z.string().optional() }).optional(),
26
+ profile: z
27
+ .looseObject({ email: z.string().optional(), display_name: z.string().optional() })
28
+ .optional(),
27
29
  }),
28
30
  });
29
31
  /** The envelope of an Events API event: the workspace the app is installed in and, on Enterprise Grid, its organization. */
@@ -104,12 +106,24 @@ export const stopped = z.looseObject({
104
106
  thread_ts: z.string(),
105
107
  user: z.string(),
106
108
  });
107
- /** A press on one of EDGAR's buttons. */
109
+ /** One block of a message, as far as a press reads it: its type, and the id of each element of an `actions` block. */
110
+ export const block = z.looseObject({
111
+ type: z.string(),
112
+ elements: z.array(z.looseObject({ action_id: z.string().optional() })).optional(),
113
+ });
114
+ /** A press on one of EDGAR's buttons, with the text and the blocks of the message that holds the button. */
108
115
  export const pressed = z.looseObject({
109
116
  type: z.literal("block_actions"),
110
117
  user: z.looseObject({ id: z.string() }),
111
118
  channel: z.looseObject({ id: z.string() }).optional(),
112
- message: z.looseObject({ ts: z.string(), thread_ts: z.string().optional() }).optional(),
119
+ message: z
120
+ .looseObject({
121
+ ts: z.string(),
122
+ thread_ts: z.string().optional(),
123
+ text: z.string().optional(),
124
+ blocks: z.array(block).optional(),
125
+ })
126
+ .optional(),
113
127
  actions: z.array(z.looseObject({ action_id: z.string(), value: z.string().optional() })).min(1),
114
128
  });
115
129
  /** The value of an answer button: the waiting key and the answer it gives. */
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "contract": 1,
3
3
  "name": "slack",
4
- "version": "0.1.3",
4
+ "version": "0.1.5",
5
5
  "config_schema": "schemas/config.json",
6
6
  "secrets": [
7
7
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kana-ai/edgar-ext-slack",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "description": "EDGAR extension for Slack: a DM or a mention opens a card, the thread shows each stage, and tools post the summary, send a DM, ask a person and delete a message.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -22,8 +22,8 @@
22
22
  ".": "./dist/src/index.js"
23
23
  },
24
24
  "dependencies": {
25
- "@kana-ai/edgar-contracts": "0.1.3",
26
- "@kana-ai/edgar-sdk": "0.1.3",
25
+ "@kana-ai/edgar-contracts": "0.1.5",
26
+ "@kana-ai/edgar-sdk": "0.1.5",
27
27
  "zod": "4.6.7"
28
28
  },
29
29
  "devDependencies": {
@@ -110,6 +110,14 @@
110
110
  ]
111
111
  }
112
112
  },
113
+ "tag": {
114
+ "description": "The only people a message may tag, so only they are notified: each a name of `people` or `operators`, or a Slack user id. Everyone else is written as their name. Not set: everyone may be tagged. Empty: nobody is.",
115
+ "type": "array",
116
+ "items": {
117
+ "type": "string",
118
+ "minLength": 1
119
+ }
120
+ },
113
121
  "close_on_done": {
114
122
  "default": false,
115
123
  "description": "With true, a run that ends done sets the Slack session status to closed; otherwise it goes back to active. Default false.",
@@ -122,7 +130,7 @@
122
130
  },
123
131
  "status": {
124
132
  "default": {},
125
- "description": "The phrase of the status line while a stage works, by stage name, such as fix = \"is reading the code\". A stage with no phrase shows \"is on it:\" and its label.",
133
+ "description": "The phrase of the status line while a stage works, by stage name, such as fix = \"is reading the code\". A stage with no phrase shows the built-in phrase of a long stage, else \"is on it:\" and its label.",
126
134
  "type": "object",
127
135
  "propertyNames": {
128
136
  "type": "string"