@eliya-oss/agent-slack 0.1.12 → 0.1.13
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/.agents/cli-api.md +16 -1
- package/CHANGELOG.md +10 -0
- package/dist/main.js +66 -3
- package/package.json +1 -1
package/.agents/cli-api.md
CHANGED
|
@@ -22,7 +22,8 @@ Non-goal for v0: agent-side summarization. The CLI returns clean context; agents
|
|
|
22
22
|
## Global Flags
|
|
23
23
|
|
|
24
24
|
```bash
|
|
25
|
-
agent-slack [--
|
|
25
|
+
agent-slack [--version] [--help]
|
|
26
|
+
[--profile NAME] [--team TEAM_ID] [--token user|bot|admin|app]
|
|
26
27
|
[--json] [--format json|ndjson|table] [--pretty] [--full]
|
|
27
28
|
[--fields FIELD[,FIELD...]]
|
|
28
29
|
[--limit N] [--cursor CURSOR] [--all]
|
|
@@ -35,6 +36,7 @@ Defaults:
|
|
|
35
36
|
- `--token user` for user-visible data.
|
|
36
37
|
- `--format json` when stdout is not a TTY.
|
|
37
38
|
- `--limit` uses Slack's method default unless a command defines a smaller agent-safe default.
|
|
39
|
+
- `--version` prints the CLI version as a bare line and exits `0`. `--help` prints the command catalog.
|
|
38
40
|
|
|
39
41
|
## Auth
|
|
40
42
|
|
|
@@ -116,6 +118,8 @@ agent-slack conversation context CHANNEL_ID [--since 24h] [--include users,threa
|
|
|
116
118
|
|
|
117
119
|
`conversation context` returns normalized messages, hydrated users, thread refs, file refs, reactions, and permalinks in one deterministic payload for agents.
|
|
118
120
|
|
|
121
|
+
`conversation list`, `conversation history`, and `conversation context` accept `--all` to auto-paginate every page, plus `--types`/`--limit` where relevant. These flags are advertised in `describe --json` and `<command> --help` so agents can discover them; without `--all` a large list returns only the first page with `paging.has_more: true`.
|
|
122
|
+
|
|
119
123
|
### Threads and messages
|
|
120
124
|
|
|
121
125
|
```bash
|
|
@@ -240,6 +244,17 @@ NDJSON streaming record:
|
|
|
240
244
|
{"ok":true,"type":"slack.message","team_id":"T123","channel_id":"C123","ts":"1710000000.000100","data":{}}
|
|
241
245
|
```
|
|
242
246
|
|
|
247
|
+
NDJSON enrichment records: when `--include` is combined with `--format ndjson`,
|
|
248
|
+
the hydration maps that `--json` returns under `data.users`/`data.threads`/`data.permalinks`
|
|
249
|
+
are streamed as typed records after the message lines, so the streaming mode is
|
|
250
|
+
not lossy. Message lines stay bare; enrichment lines carry a `type`:
|
|
251
|
+
|
|
252
|
+
```json
|
|
253
|
+
{"type":"slack.user","data":{"id":"U123","name":"ada","real_name":"Ada"}}
|
|
254
|
+
{"type":"slack.thread","data":{"ts":"1710000000.000100","replies":[]}}
|
|
255
|
+
{"type":"slack.permalink","data":{"ts":"1710000000.000100","permalink":"https://slack.com/..."}}
|
|
256
|
+
```
|
|
257
|
+
|
|
243
258
|
Structured error on stderr:
|
|
244
259
|
|
|
245
260
|
```json
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# @eliya-oss/agent-slack
|
|
2
2
|
|
|
3
|
+
## 0.1.13
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 48d5879: Three CLI fixes for agents.
|
|
8
|
+
|
|
9
|
+
- `agent-slack --version` now prints the version and exits 0 instead of raising a usage error.
|
|
10
|
+
- `conversation list`, `conversation history`, and `conversation context` now advertise their pagination flags (`--all`, `--types`, `--limit`) in `describe --json` and `--help`, so agents can discover `--all` instead of only getting the first page.
|
|
11
|
+
- `--include users,threads,permalinks` now works with `--format ndjson`: the hydrated users, threads, and permalinks are streamed as typed records (`slack.user`, `slack.thread`, `slack.permalink`) after the message lines. Previously they were only present with `--json` and silently dropped in ndjson.
|
|
12
|
+
|
|
3
13
|
## 0.1.12
|
|
4
14
|
|
|
5
15
|
### Patch Changes
|
package/dist/main.js
CHANGED
|
@@ -25105,6 +25105,7 @@ const booleanFlags = /* @__PURE__ */ new Set([
|
|
|
25105
25105
|
"all",
|
|
25106
25106
|
"allow-write",
|
|
25107
25107
|
"help",
|
|
25108
|
+
"version",
|
|
25108
25109
|
"json",
|
|
25109
25110
|
"no-color",
|
|
25110
25111
|
"raw",
|
|
@@ -25523,7 +25524,7 @@ const truncate = (value, width) => value.length > width ? `${value.slice(0, Math
|
|
|
25523
25524
|
//#endregion
|
|
25524
25525
|
//#region src/cli/metadata.ts
|
|
25525
25526
|
createRequire(import.meta.url);
|
|
25526
|
-
const packageJson = { version: "0.1.
|
|
25527
|
+
const packageJson = { version: "0.1.13" };
|
|
25527
25528
|
const PRIMARY_COMMAND_NAME = "agent-slack";
|
|
25528
25529
|
const SHORT_COMMAND_NAME = "aslk";
|
|
25529
25530
|
const COMMAND_NAMES = [PRIMARY_COMMAND_NAME, SHORT_COMMAND_NAME];
|
|
@@ -25764,6 +25765,12 @@ const commandMetadata = [
|
|
|
25764
25765
|
{
|
|
25765
25766
|
path: ["conversation", "list"],
|
|
25766
25767
|
summary: "List conversations visible to the active profile.",
|
|
25768
|
+
flags: [
|
|
25769
|
+
"--types",
|
|
25770
|
+
"--limit",
|
|
25771
|
+
"--all",
|
|
25772
|
+
"--json"
|
|
25773
|
+
],
|
|
25767
25774
|
methods: ["conversations.list"],
|
|
25768
25775
|
scopes: [
|
|
25769
25776
|
"channels:read",
|
|
@@ -25773,12 +25780,21 @@ const commandMetadata = [
|
|
|
25773
25780
|
],
|
|
25774
25781
|
safety: "read",
|
|
25775
25782
|
output: "conversation list",
|
|
25776
|
-
examples: ["agent-slack conversation list --types public_channel,private_channel --json"]
|
|
25783
|
+
examples: ["agent-slack conversation list --types public_channel,private_channel --json", "agent-slack conversation list --all --json"]
|
|
25777
25784
|
},
|
|
25778
25785
|
{
|
|
25779
25786
|
path: ["conversation", "history"],
|
|
25780
25787
|
summary: "Read conversation history.",
|
|
25781
25788
|
args: ["CHANNEL_ID"],
|
|
25789
|
+
flags: [
|
|
25790
|
+
"--oldest",
|
|
25791
|
+
"--latest",
|
|
25792
|
+
"--since",
|
|
25793
|
+
"--inclusive",
|
|
25794
|
+
"--limit",
|
|
25795
|
+
"--all",
|
|
25796
|
+
"--json"
|
|
25797
|
+
],
|
|
25782
25798
|
methods: ["conversations.history"],
|
|
25783
25799
|
scopes: [
|
|
25784
25800
|
"channels:history",
|
|
@@ -25794,6 +25810,15 @@ const commandMetadata = [
|
|
|
25794
25810
|
path: ["conversation", "context"],
|
|
25795
25811
|
summary: "Build channel context for agents.",
|
|
25796
25812
|
args: ["CHANNEL_ID"],
|
|
25813
|
+
flags: [
|
|
25814
|
+
"--since",
|
|
25815
|
+
"--include",
|
|
25816
|
+
"--limit",
|
|
25817
|
+
"--all",
|
|
25818
|
+
"--full",
|
|
25819
|
+
"--format",
|
|
25820
|
+
"--json"
|
|
25821
|
+
],
|
|
25797
25822
|
methods: [
|
|
25798
25823
|
"conversations.history",
|
|
25799
25824
|
"conversations.replies",
|
|
@@ -25911,6 +25936,7 @@ const renderHumanHelp = (path) => {
|
|
|
25911
25936
|
command.summary,
|
|
25912
25937
|
"",
|
|
25913
25938
|
command.args === void 0 ? "" : `Usage: ${PRIMARY_COMMAND_NAME} ${command.path.join(" ")} ${command.args.join(" ")}`,
|
|
25939
|
+
command.flags === void 0 ? "" : `Flags: ${command.flags.join(" ")}`,
|
|
25914
25940
|
command.scopes === void 0 ? "" : `Scopes: ${command.scopes.join(", ")}`,
|
|
25915
25941
|
"",
|
|
25916
25942
|
"Examples:",
|
|
@@ -26249,6 +26275,12 @@ const extractItems = (services, method, response) => {
|
|
|
26249
26275
|
const dispatch = async (parsed, services) => {
|
|
26250
26276
|
const pos = parsed.positionals;
|
|
26251
26277
|
const [first, second, third] = pos;
|
|
26278
|
+
if (flagBoolean(parsed, "version")) return {
|
|
26279
|
+
method: "version",
|
|
26280
|
+
profile: null,
|
|
26281
|
+
stdoutValue: null,
|
|
26282
|
+
rawStdout: `${CLI_VERSION}\n`
|
|
26283
|
+
};
|
|
26252
26284
|
if (flagBoolean(parsed, "help") && !flagBoolean(parsed, "json")) return {
|
|
26253
26285
|
method: "help",
|
|
26254
26286
|
profile: null,
|
|
@@ -26656,6 +26688,26 @@ const conversationContext = async (parsed, services) => {
|
|
|
26656
26688
|
response: history.response,
|
|
26657
26689
|
stdoutValue: context,
|
|
26658
26690
|
items: messages.map(shape),
|
|
26691
|
+
enrichmentRecords: [
|
|
26692
|
+
...recordsFromMap(context.users, (_, data) => ({
|
|
26693
|
+
type: "slack.user",
|
|
26694
|
+
data
|
|
26695
|
+
})),
|
|
26696
|
+
...recordsFromMap(context.threads, (ts, replies) => ({
|
|
26697
|
+
type: "slack.thread",
|
|
26698
|
+
data: {
|
|
26699
|
+
ts,
|
|
26700
|
+
replies
|
|
26701
|
+
}
|
|
26702
|
+
})),
|
|
26703
|
+
...recordsFromMap(context.permalinks, (ts, permalink) => ({
|
|
26704
|
+
type: "slack.permalink",
|
|
26705
|
+
data: {
|
|
26706
|
+
ts,
|
|
26707
|
+
permalink
|
|
26708
|
+
}
|
|
26709
|
+
}))
|
|
26710
|
+
],
|
|
26659
26711
|
...warnings.length > 0 ? { warnings } : {}
|
|
26660
26712
|
};
|
|
26661
26713
|
};
|
|
@@ -26736,6 +26788,16 @@ const threadGet = async (parsed, services) => {
|
|
|
26736
26788
|
response: result.response,
|
|
26737
26789
|
stdoutValue: data,
|
|
26738
26790
|
items: rawMessages.map(shape),
|
|
26791
|
+
enrichmentRecords: [...recordsFromMap(data.users, (_, user) => ({
|
|
26792
|
+
type: "slack.user",
|
|
26793
|
+
data: user
|
|
26794
|
+
})), ...recordsFromMap(data.permalinks, (ts, permalink) => ({
|
|
26795
|
+
type: "slack.permalink",
|
|
26796
|
+
data: {
|
|
26797
|
+
ts,
|
|
26798
|
+
permalink
|
|
26799
|
+
}
|
|
26800
|
+
}))],
|
|
26739
26801
|
...warnings.length > 0 ? { warnings } : {}
|
|
26740
26802
|
};
|
|
26741
26803
|
};
|
|
@@ -26844,7 +26906,7 @@ const methodCall = async (parsed, services, input, options = {}) => {
|
|
|
26844
26906
|
};
|
|
26845
26907
|
const renderDispatchResult = (parsed, result, options = {}) => {
|
|
26846
26908
|
if (result.rawStdout !== void 0) return result.rawStdout;
|
|
26847
|
-
if (flagString(parsed, "format") === "ndjson") return toNdjson(result.items ?? []);
|
|
26909
|
+
if (flagString(parsed, "format") === "ndjson") return toNdjson([...result.items ?? [], ...result.enrichmentRecords ?? []]);
|
|
26848
26910
|
const data = projectFields(result.stdoutValue, flagString(parsed, "fields"));
|
|
26849
26911
|
const envelope = successEnvelope({
|
|
26850
26912
|
method: result.method,
|
|
@@ -26901,6 +26963,7 @@ const stringField = (record, name) => typeof record[name] === "string" && record
|
|
|
26901
26963
|
const extractArray = (value) => Array.isArray(value) ? value : [];
|
|
26902
26964
|
const extractLooseRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value) ? value : {};
|
|
26903
26965
|
const uniqueStrings = (values) => [...new Set(values.filter((value) => value !== void 0))];
|
|
26966
|
+
const recordsFromMap = (value, toRecord) => Object.entries(extractLooseRecord(value)).map(([key, entry]) => toRecord(key, entry));
|
|
26904
26967
|
//#endregion
|
|
26905
26968
|
//#region src/application/execute.ts
|
|
26906
26969
|
const executeCli = async (argv, services, options = {}) => {
|