@crvouga/mockingbird-service-slack 3.6.0 → 3.8.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.
- package/CHANGELOG.md +14 -1
- package/README.md +15 -1
- package/dist/{chunk-TMQCTVOT.js → chunk-H3RHERS3.js} +115 -15
- package/dist/chunk-H3RHERS3.js.map +7 -0
- package/dist/{chunk-4JPRLFNZ.js → chunk-LQUZASGQ.js} +264 -63
- package/dist/chunk-LQUZASGQ.js.map +7 -0
- package/dist/cli.js +2 -2
- package/dist/index.d.ts +28 -0
- package/dist/index.js +1 -1
- package/dist/server.d.ts +71 -0
- package/dist/server.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-4JPRLFNZ.js.map +0 -7
- package/dist/chunk-TMQCTVOT.js.map +0 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,19 @@
|
|
|
1
1
|
# Changelog — @crvouga/mockingbird-service-slack
|
|
2
2
|
|
|
3
|
-
## 3.
|
|
3
|
+
## 3.8.0 (2026-10-21)
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
- raise the serve and fleet body limit to the S3 maximum ([86b9e2b](https://github.com/crvouga/mockingbird/commit/86b9e2b80bcaaaef57f52edbac50b27da0b42f33))
|
|
8
|
+
- validate block limits, filter nutrients, list block children ([2acb823](https://github.com/crvouga/mockingbird/commit/2acb823ba66b30f3d03221996e015c127b0f72c6))
|
|
9
|
+
|
|
10
|
+
## 3.7.0 (2026-10-18)
|
|
11
|
+
|
|
12
|
+
### Features
|
|
13
|
+
|
|
14
|
+
- resolve the agent-reported issue queue in one batch ([25c52b6](https://github.com/crvouga/mockingbird/commit/25c52b668a53ddb80b968419601a20abf33f956b))
|
|
15
|
+
|
|
16
|
+
## 3.6.0 (2026-10-16)
|
|
4
17
|
|
|
5
18
|
### Features
|
|
6
19
|
|
package/README.md
CHANGED
|
@@ -64,7 +64,7 @@ await server.close()
|
|
|
64
64
|
|
|
65
65
|
| Route | Behaviour |
|
|
66
66
|
| --- | --- |
|
|
67
|
-
| `POST /services/{T}/{B}/{X}` | Incoming webhook. JSON `{text, blocks?, attachments?, thread_ts?}` (or form `payload=<json>`) → `200 ok` (text/plain). `400 invalid_payload` (not a JSON object), `400 no_text` (no text, blocks or attachments), `400 invalid_blocks
|
|
67
|
+
| `POST /services/{T}/{B}/{X}` | Incoming webhook. JSON `{text, blocks?, attachments?, thread_ts?}` (or form `payload=<json>`) → `200 ok` (text/plain). `400 invalid_payload` (not a JSON object), `400 no_text` (no text, blocks or attachments), `400 invalid_blocks` (structure and Block Kit limits, also inside `attachments[].blocks`; see below), `400 too_many_attachments`, `404 no_service` (unregistered hook, once any hook is registered), `404 channel_not_found`, `410 channel_is_archived`. |
|
|
68
68
|
| `POST /api/chat.postMessage` | `{channel, text?, blocks?, attachments?, thread_ts?, unfurl_links?}` → `{ok, channel, ts, message}`. `channel` is an id or `#name`; unknown channels are created on first use unless `strictChannels`. The outbox keeps `text`, `blocks`, `unfurl_links`, `thread_ts`, and `workspace` (the team id). Errors: `channel_not_found`, `no_text`, `invalid_blocks`, `invalid_blocks_format`, `msg_too_long`, `is_archived`. |
|
|
69
69
|
| `POST /api/chat.update` | `{channel, ts, text?, blocks?}` → `{ok, channel, ts, text, message}` with `edited`; `message_not_found`, `cant_update_message` (webhook posts). Omitted blocks are kept. |
|
|
70
70
|
| `POST /api/chat.postEphemeral` | `{channel, user, text}` → `{ok, message_ts}`; `user_not_found`. Recorded in the outbox with `ephemeral: true`. |
|
|
@@ -132,6 +132,20 @@ maps a bot token or a webhook's `T/B/X` path to a namespace.
|
|
|
132
132
|
trigger-id expiry for `views.open`.
|
|
133
133
|
- Message formatting (mrkdwn parsing, link unfurling, mention resolution): text and blocks are
|
|
134
134
|
stored verbatim.
|
|
135
|
+
- Block Kit limits are a **best guess, not oracle-verified** (from the per-block pages on
|
|
136
|
+
docs.slack.dev; the exact status and message Slack returns for each rule was never observed
|
|
137
|
+
live). `blocks` and each `attachments[].blocks` are rejected as `invalid_blocks` (webhook: `400
|
|
138
|
+
invalid_blocks`; `chat.postMessage`, `chat.update`, `chat.postEphemeral`: `200 {ok: false, error:
|
|
139
|
+
"invalid_blocks", response_metadata: {messages}}`, the messages being the emulator's own wording)
|
|
140
|
+
when: there are more than 50 blocks (in each array; whether Slack applies 50 inside attachments is
|
|
141
|
+
unconfirmed); a block's `type` is not a Block Kit block type; a `section` `text` is over 3000
|
|
142
|
+
characters or its `fields` are over 10 items or 2000 characters each; a `header` `text` is not
|
|
143
|
+
`plain_text` or is over 150 characters; `context` has over 10 `elements` or `actions` over 25; a
|
|
144
|
+
`block_id` is over 255 characters; a text object is empty. Exactly-at-limit values are accepted
|
|
145
|
+
and stored verbatim, and a rejected message stores nothing (an update leaves the original
|
|
146
|
+
untouched). Required-field rules (a `section` with neither `text` nor `fields`, an `image`
|
|
147
|
+
without `alt_text`), element-level validation inside `actions` / `context` / `input` / `rich_text`,
|
|
148
|
+
and the other attachment fields are not modelled.
|
|
135
149
|
|
|
136
150
|
## API
|
|
137
151
|
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
markSocketClosed,
|
|
7
7
|
normalizeBootControls,
|
|
8
8
|
normalizeControls,
|
|
9
|
+
normalizeIdBase,
|
|
9
10
|
openSocketCount,
|
|
10
11
|
ownedTransport,
|
|
11
12
|
parseDuration,
|
|
@@ -13,12 +14,25 @@ import {
|
|
|
13
14
|
resolveAdminPrefix,
|
|
14
15
|
restoreClock,
|
|
15
16
|
unbindSocketTransport
|
|
16
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-LQUZASGQ.js";
|
|
17
18
|
|
|
18
19
|
// ../../adapters/node/dist/cli.js
|
|
19
20
|
import { readFile as readFile5 } from "node:fs/promises";
|
|
20
21
|
import { parseArgs } from "node:util";
|
|
21
22
|
|
|
23
|
+
// ../../adapters/node/dist/boot-settings.js
|
|
24
|
+
var checkSettings = (target, settings, label) => {
|
|
25
|
+
if (!target.parseSettings)
|
|
26
|
+
throw new Error(`${label}: ${target.name} takes no boot settings`);
|
|
27
|
+
try {
|
|
28
|
+
return target.parseSettings(settings);
|
|
29
|
+
} catch (error) {
|
|
30
|
+
throw new Error(`${label}: ${error instanceof Error ? error.message : String(error)}`, {
|
|
31
|
+
cause: error
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
|
|
22
36
|
// ../../adapters/node/dist/fleet.js
|
|
23
37
|
import { AsyncLocalStorage as AsyncLocalStorage2 } from "node:async_hooks";
|
|
24
38
|
import { createHash as createHash4, randomUUID as randomUUID4 } from "node:crypto";
|
|
@@ -2668,6 +2682,9 @@ var fleet_config_schema_default = {
|
|
|
2668
2682
|
adminControls: {
|
|
2669
2683
|
$ref: "#/$defs/controls"
|
|
2670
2684
|
},
|
|
2685
|
+
idBase: {
|
|
2686
|
+
$ref: "#/$defs/idBase"
|
|
2687
|
+
},
|
|
2671
2688
|
namespace: {
|
|
2672
2689
|
type: "string",
|
|
2673
2690
|
pattern: "^[A-Za-z0-9_.-]{1,64}$"
|
|
@@ -2757,6 +2774,12 @@ var fleet_config_schema_default = {
|
|
|
2757
2774
|
adminControls: {
|
|
2758
2775
|
$ref: "#/$defs/controls"
|
|
2759
2776
|
},
|
|
2777
|
+
idBase: {
|
|
2778
|
+
$ref: "#/$defs/idBase"
|
|
2779
|
+
},
|
|
2780
|
+
settings: {
|
|
2781
|
+
type: "object"
|
|
2782
|
+
},
|
|
2760
2783
|
fixtures: {
|
|
2761
2784
|
type: "object"
|
|
2762
2785
|
},
|
|
@@ -2803,6 +2826,18 @@ var fleet_config_schema_default = {
|
|
|
2803
2826
|
}
|
|
2804
2827
|
}
|
|
2805
2828
|
},
|
|
2829
|
+
idBase: {
|
|
2830
|
+
anyOf: [
|
|
2831
|
+
{
|
|
2832
|
+
type: "integer",
|
|
2833
|
+
minimum: 0
|
|
2834
|
+
},
|
|
2835
|
+
{
|
|
2836
|
+
type: "string",
|
|
2837
|
+
pattern: "^(boot|[0-9]+)$"
|
|
2838
|
+
}
|
|
2839
|
+
]
|
|
2840
|
+
},
|
|
2806
2841
|
controls: {
|
|
2807
2842
|
type: "object",
|
|
2808
2843
|
additionalProperties: false,
|
|
@@ -2952,6 +2987,8 @@ async function preflightFleet(config, options) {
|
|
|
2952
2987
|
throw new Error("protected archive policy requires a protected repository; configure its protector before startup");
|
|
2953
2988
|
resolveAdminPrefix(config.adminPrefix);
|
|
2954
2989
|
normalizeBootControls(config.adminControls);
|
|
2990
|
+
if (config.idBase !== void 0)
|
|
2991
|
+
normalizeIdBase(config.idBase, "idBase");
|
|
2955
2992
|
const targets = /* @__PURE__ */ new Map();
|
|
2956
2993
|
const ports = /* @__PURE__ */ new Set();
|
|
2957
2994
|
for (const [name, entry] of Object.entries(config.services)) {
|
|
@@ -2983,6 +3020,13 @@ async function preflightFleet(config, options) {
|
|
|
2983
3020
|
throw new Error("invalid protocol namespace selector");
|
|
2984
3021
|
}
|
|
2985
3022
|
}
|
|
3023
|
+
if (entry.idBase !== void 0)
|
|
3024
|
+
normalizeIdBase(entry.idBase, "idBase");
|
|
3025
|
+
if (entry.settings !== void 0) {
|
|
3026
|
+
if (protocol !== "http" || !("create" in target))
|
|
3027
|
+
throw new Error("settings: only HTTP services take boot settings");
|
|
3028
|
+
checkSettings(target, entry.settings, "settings");
|
|
3029
|
+
}
|
|
2986
3030
|
const port = entry.port ?? target.defaultPort;
|
|
2987
3031
|
if (port !== 0) {
|
|
2988
3032
|
const key = `${entry.host ?? "127.0.0.1"}:${port}`;
|
|
@@ -3018,7 +3062,7 @@ async function preflightFleet(config, options) {
|
|
|
3018
3062
|
break;
|
|
3019
3063
|
}
|
|
3020
3064
|
}
|
|
3021
|
-
targets.set(name, { ...target, packageVersion: packageVersion ?? "3.
|
|
3065
|
+
targets.set(name, { ...target, packageVersion: packageVersion ?? "3.8.0" });
|
|
3022
3066
|
} catch (error) {
|
|
3023
3067
|
throw new Error(`service ${name}: ${error instanceof Error ? error.message : String(error)}`, { cause: error });
|
|
3024
3068
|
}
|
|
@@ -3244,7 +3288,11 @@ var serve = async (api, options = {}) => {
|
|
|
3244
3288
|
// ../../adapters/node/dist/listen.js
|
|
3245
3289
|
var listen = async (api, options = {}) => {
|
|
3246
3290
|
const host = options.host ?? "127.0.0.1";
|
|
3247
|
-
const server = await serve(api, {
|
|
3291
|
+
const server = await serve(api, {
|
|
3292
|
+
port: options.port ?? 0,
|
|
3293
|
+
host,
|
|
3294
|
+
...options.maxBodyBytes !== void 0 ? { maxBodyBytes: options.maxBodyBytes } : {}
|
|
3295
|
+
});
|
|
3248
3296
|
const address = server.address();
|
|
3249
3297
|
const port = typeof address === "object" && address !== null ? address.port : options.port ?? 0;
|
|
3250
3298
|
const shown = host.includes(":") ? `[${host}]` : host;
|
|
@@ -3338,6 +3386,7 @@ var httpChild = async (target, entry, options, admission, generation, privateAcc
|
|
|
3338
3386
|
options.onLog?.(entry2);
|
|
3339
3387
|
},
|
|
3340
3388
|
...entry.adminControls !== void 0 ? { adminControls: entry.adminControls } : {},
|
|
3389
|
+
...entry.settings !== void 0 ? { settings: checkSettings(target, entry.settings, "settings") } : {},
|
|
3341
3390
|
...entry.fixtures !== void 0 ? { fixtures: entry.fixtures } : {},
|
|
3342
3391
|
...(advertisedHttpBase(entry) ?? entry.baseUrl) !== void 0 ? { baseUrl: advertisedHttpBase(entry) ?? entry.baseUrl } : {}
|
|
3343
3392
|
});
|
|
@@ -3356,6 +3405,8 @@ var httpChild = async (target, entry, options, admission, generation, privateAcc
|
|
|
3356
3405
|
].some((method) => typeof created[method] !== "function"))
|
|
3357
3406
|
throw new Error("HTTP target does not implement the fleet runtime protocol; build/install matching supported service versions");
|
|
3358
3407
|
const runtime = created;
|
|
3408
|
+
if (entry.idBase !== void 0)
|
|
3409
|
+
runtime.setIdBase?.(entry.idBase);
|
|
3359
3410
|
const unobserve = runtime.webhooks?.observeDeliveries(observer.delivery);
|
|
3360
3411
|
if (options.outbound && runtime.webhooks)
|
|
3361
3412
|
runtime.webhooks.setTransportPolicy(ownedTransport(options.outbound));
|
|
@@ -3440,7 +3491,8 @@ var httpChild = async (target, entry, options, admission, generation, privateAcc
|
|
|
3440
3491
|
try {
|
|
3441
3492
|
server = await listen(api, {
|
|
3442
3493
|
port: entry.port ?? target.defaultPort,
|
|
3443
|
-
host: entry.host ?? "127.0.0.1"
|
|
3494
|
+
host: entry.host ?? "127.0.0.1",
|
|
3495
|
+
...target.maxBodyBytes !== void 0 ? { maxBodyBytes: target.maxBodyBytes } : {}
|
|
3444
3496
|
});
|
|
3445
3497
|
target.listening?.(server);
|
|
3446
3498
|
} catch (error) {
|
|
@@ -3954,6 +4006,7 @@ async function startFleet(config, options) {
|
|
|
3954
4006
|
...entry,
|
|
3955
4007
|
adminPrefix: resolveAdminPrefix(entry.adminPrefix ?? adminPrefix),
|
|
3956
4008
|
...adminKey !== void 0 ? { adminKey } : {},
|
|
4009
|
+
...(entry.idBase ?? config.idBase) !== void 0 ? { idBase: entry.idBase ?? config.idBase } : {},
|
|
3957
4010
|
// Fleet-wide controls, with the service's own keys replacing them.
|
|
3958
4011
|
...config.adminControls !== void 0 || entry.adminControls !== void 0 ? { adminControls: { ...config.adminControls, ...entry.adminControls } } : {}
|
|
3959
4012
|
}, options, (namespace, request) => management?.admit(namespace, request), (namespace) => management?.generation(namespace), (namespace, request) => management?.privateRequest(namespace, request) ?? false, {
|
|
@@ -4638,6 +4691,16 @@ var COMMON_SERVE_OPTIONS = {
|
|
|
4638
4691
|
value: "<seed>",
|
|
4639
4692
|
description: "Seed for every random choice (env MOCKINGBIRD_SEED)"
|
|
4640
4693
|
},
|
|
4694
|
+
"id-base": {
|
|
4695
|
+
type: "string",
|
|
4696
|
+
value: "<n|boot>",
|
|
4697
|
+
description: "Start generated ids at this base so a restart does not reissue the last boot's ids; boot derives one from the clock (env MOCKINGBIRD_ID_BASE; default 0, the same ids every boot)"
|
|
4698
|
+
},
|
|
4699
|
+
settings: {
|
|
4700
|
+
type: "string",
|
|
4701
|
+
value: "<json|file>",
|
|
4702
|
+
description: "Service settings to boot with, as JSON or a JSON file; every namespace starts from them (env MOCKINGBIRD_SETTINGS; only for services that declare settings)"
|
|
4703
|
+
},
|
|
4641
4704
|
"admin-controls": {
|
|
4642
4705
|
type: "string",
|
|
4643
4706
|
value: "<json|file>",
|
|
@@ -4732,19 +4795,40 @@ var readJsonFile = async (path, label) => {
|
|
|
4732
4795
|
}
|
|
4733
4796
|
};
|
|
4734
4797
|
var isObject2 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
4798
|
+
var readJsonOption = async (source, label) => {
|
|
4799
|
+
const trimmed = source.trim();
|
|
4800
|
+
if (trimmed.startsWith("{") || trimmed.startsWith("[")) {
|
|
4801
|
+
try {
|
|
4802
|
+
return JSON.parse(trimmed);
|
|
4803
|
+
} catch {
|
|
4804
|
+
throw new Error(`${label}: not valid JSON`);
|
|
4805
|
+
}
|
|
4806
|
+
}
|
|
4807
|
+
return readJsonFile(source, label);
|
|
4808
|
+
};
|
|
4809
|
+
var resolveServeIdBase = (values, env = process.env) => {
|
|
4810
|
+
const source = asString(values["id-base"]) ?? env.MOCKINGBIRD_ID_BASE;
|
|
4811
|
+
if (source === void 0 || source.trim() === "")
|
|
4812
|
+
return void 0;
|
|
4813
|
+
normalizeIdBase(source.trim(), "--id-base");
|
|
4814
|
+
return source.trim();
|
|
4815
|
+
};
|
|
4816
|
+
var resolveServeSettings = async (target, values, env = process.env) => {
|
|
4817
|
+
const flag = asString(values.settings);
|
|
4818
|
+
const source = flag ?? env.MOCKINGBIRD_SETTINGS;
|
|
4819
|
+
if (source === void 0 || source.trim() === "")
|
|
4820
|
+
return void 0;
|
|
4821
|
+
const label = flag !== void 0 ? "--settings" : "MOCKINGBIRD_SETTINGS";
|
|
4822
|
+
const parsed = await readJsonOption(source, label);
|
|
4823
|
+
if (!isObject2(parsed))
|
|
4824
|
+
throw new Error(`${label}: expected a JSON object`);
|
|
4825
|
+
return checkSettings(target, parsed, label);
|
|
4826
|
+
};
|
|
4735
4827
|
var resolveServeControls = async (values, env = process.env, base) => {
|
|
4736
4828
|
const source = asString(values["admin-controls"]) ?? env.MOCKINGBIRD_ADMIN_CONTROLS;
|
|
4737
4829
|
let document = isObject2(base) ? { ...base } : {};
|
|
4738
4830
|
if (source !== void 0 && source.trim() !== "") {
|
|
4739
|
-
|
|
4740
|
-
if (source.trim().startsWith("{")) {
|
|
4741
|
-
try {
|
|
4742
|
-
parsed = JSON.parse(source);
|
|
4743
|
-
} catch {
|
|
4744
|
-
throw new Error("--admin-controls: not valid JSON");
|
|
4745
|
-
}
|
|
4746
|
-
} else
|
|
4747
|
-
parsed = await readJsonFile(source, "--admin-controls");
|
|
4831
|
+
const parsed = source.trim().startsWith("{") ? await readJsonOption(source, "--admin-controls") : await readJsonFile(source, "--admin-controls");
|
|
4748
4832
|
if (!isObject2(parsed))
|
|
4749
4833
|
throw new Error("--admin-controls: expected a JSON object");
|
|
4750
4834
|
document = { ...document, ...parsed };
|
|
@@ -4794,9 +4878,16 @@ var start = async (target, values, config) => {
|
|
|
4794
4878
|
adminKey: config.adminKey,
|
|
4795
4879
|
seed: config.seed,
|
|
4796
4880
|
onLog: formatLog(config.log),
|
|
4881
|
+
...config.settings !== void 0 ? { settings: config.settings } : {},
|
|
4797
4882
|
...config.adminControls !== void 0 ? { adminControls: config.adminControls } : {}
|
|
4798
4883
|
});
|
|
4799
|
-
|
|
4884
|
+
if (config.idBase !== void 0)
|
|
4885
|
+
runtime.setIdBase?.(config.idBase);
|
|
4886
|
+
const listening = await listen(runtime, {
|
|
4887
|
+
port: config.port,
|
|
4888
|
+
host: config.host,
|
|
4889
|
+
...target.maxBodyBytes !== void 0 ? { maxBodyBytes: target.maxBodyBytes } : {}
|
|
4890
|
+
});
|
|
4800
4891
|
target.listening?.(listening);
|
|
4801
4892
|
console.log(`${target.name} emulator listening on ${listening.url}`);
|
|
4802
4893
|
console.log(`${target.name} health: GET ${listening.url}${adminPrefix}/health`);
|
|
@@ -4841,6 +4932,11 @@ var serveCommand = (target) => ({
|
|
|
4841
4932
|
const adminControls = await resolveServeControls(values, process.env, config.adminControls);
|
|
4842
4933
|
if (adminControls !== void 0)
|
|
4843
4934
|
config.adminControls = adminControls;
|
|
4935
|
+
if (values.settings !== void 0)
|
|
4936
|
+
throw new Error("--settings serves a single service; give each service its own `settings` in the config");
|
|
4937
|
+
const idBase = config.idBase ?? resolveServeIdBase(values);
|
|
4938
|
+
if (idBase !== void 0)
|
|
4939
|
+
config.idBase = idBase;
|
|
4844
4940
|
const fleet = await startFleet(config, {
|
|
4845
4941
|
load: (name) => loadTarget(name, target),
|
|
4846
4942
|
onLog: formatLog(config.log ?? log),
|
|
@@ -4870,8 +4966,12 @@ var serveCommand = (target) => ({
|
|
|
4870
4966
|
let listening;
|
|
4871
4967
|
try {
|
|
4872
4968
|
const adminControls = await resolveServeControls(values);
|
|
4969
|
+
const idBase = resolveServeIdBase(values);
|
|
4970
|
+
const settings = await resolveServeSettings(target, values);
|
|
4873
4971
|
listening = await start(target, values, {
|
|
4874
4972
|
...adminControls !== void 0 ? { adminControls } : {},
|
|
4973
|
+
...idBase !== void 0 ? { idBase } : {},
|
|
4974
|
+
...settings !== void 0 ? { settings } : {},
|
|
4875
4975
|
adminPrefix: resolveAdminPrefix(asString(values["admin-prefix"]) ?? process.env.MOCKINGBIRD_ADMIN_PREFIX),
|
|
4876
4976
|
port: port === void 0 ? target.defaultPort : Number.parseInt(port, 10),
|
|
4877
4977
|
host: asString(values.host) ?? "127.0.0.1",
|
|
@@ -5283,4 +5383,4 @@ export {
|
|
|
5283
5383
|
createServer2 as createServer,
|
|
5284
5384
|
serveTarget
|
|
5285
5385
|
};
|
|
5286
|
-
//# sourceMappingURL=chunk-
|
|
5386
|
+
//# sourceMappingURL=chunk-H3RHERS3.js.map
|