@excitedjs/feishu-channel 6.3.1-beta.274 → 6.4.0-beta.276
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/README.md +40 -22
- package/dist/extension.d.ts +51 -1
- package/dist/extension.d.ts.map +1 -1
- package/dist/feishu-core-commands.d.ts +3 -3
- package/dist/feishu-core-commands.d.ts.map +1 -1
- package/dist/feishu-core-commands.js +3 -3
- package/dist/feishu-core-commands.js.map +1 -1
- package/dist/feishu-extensions.d.ts +2 -2
- package/dist/feishu-extensions.d.ts.map +1 -1
- package/dist/feishu-extensions.js +69 -12
- package/dist/feishu-extensions.js.map +1 -1
- package/dist/feishu-submit.d.ts +52 -19
- package/dist/feishu-submit.d.ts.map +1 -1
- package/dist/feishu-submit.js.map +1 -1
- package/dist/inbound/pipeline.js +2 -2
- package/dist/inbound/pipeline.js.map +1 -1
- package/dist/inbound/router.d.ts +2 -2
- package/dist/inbound/router.d.ts.map +1 -1
- package/dist/inbound/router.js +2 -2
- package/dist/inbound/router.js.map +1 -1
- package/dist/inbound/target.d.ts +40 -43
- package/dist/inbound/target.d.ts.map +1 -1
- package/dist/inbound/target.js +42 -62
- package/dist/inbound/target.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/outbound/index.d.ts +6 -7
- package/dist/outbound/index.d.ts.map +1 -1
- package/dist/outbound/index.js +7 -4
- package/dist/outbound/index.js.map +1 -1
- package/dist/routing/index.d.ts +8 -3
- package/dist/routing/index.d.ts.map +1 -1
- package/dist/routing/index.js +12 -6
- package/dist/routing/index.js.map +1 -1
- package/dist/routing/target.d.ts +21 -3
- package/dist/routing/target.d.ts.map +1 -1
- package/dist/routing/target.js +25 -3
- package/dist/routing/target.js.map +1 -1
- package/dist/session/card-actions.d.ts.map +1 -1
- package/dist/session/card-actions.js +8 -4
- package/dist/session/card-actions.js.map +1 -1
- package/dist/session/session.d.ts.map +1 -1
- package/dist/session/session.js +1 -2
- package/dist/session/session.js.map +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -19,9 +19,10 @@ the Feishu channel ships out of the box.
|
|
|
19
19
|
- **Inbound normalization**: turning Feishu events into agent-facing channel
|
|
20
20
|
results, including the Channel-owned inner body and inline `<attachment>`
|
|
21
21
|
blocks. Core owns the outer `<channel source="feishu" …>` envelope.
|
|
22
|
-
- **Topic routing**:
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
- **Topic routing**: projecting `thread_id` as a neutral collaboration target
|
|
23
|
+
whatever the group's current message format is, observing that format only to
|
|
24
|
+
decide whether an unbound topic may receive a new Team, and recording exact
|
|
25
|
+
per-message targets for scoped TeamLeader replies.
|
|
25
26
|
- **Attachment handling**: downloading inbound attachments after the host access
|
|
26
27
|
gate allows delivery, plus cache layout, path sanitization, permissions, and
|
|
27
28
|
honest fallback references when a resource is not downloaded. Inline XML is
|
|
@@ -50,7 +51,12 @@ the Feishu channel ships out of the box.
|
|
|
50
51
|
contributes the `feishu` channel provider (`builtin:feishu`) and publishes
|
|
51
52
|
`FeishuApi`, through which another plugin registers Feishu extensions: extra
|
|
52
53
|
MCP tools, card actions, and a per-channel-instance lifecycle with an
|
|
53
|
-
instance api (`FeishuExtension`, `FeishuInstanceApi`).
|
|
54
|
+
instance api (`FeishuExtension`, `FeishuInstanceApi`). That api includes
|
|
55
|
+
`submitToBoundTeam`: an extension delivers work of its own (after a click or
|
|
56
|
+
from a timer) to the one Team the conversation still routes to, with no card
|
|
57
|
+
callback and no Core port of its own, and receives Core's actual admission
|
|
58
|
+
outcome. It never provisions a Team or falls back to another recipient, and
|
|
59
|
+
it claims no presentation anchor.
|
|
54
60
|
- `createFeishuChannelProvider()` — the same provider with no extensions. Its
|
|
55
61
|
`createSession` returns a `ChannelInstance`: a `session` with
|
|
56
62
|
`initialize` / `start` / `close`, plus the optional `mcp` capability beside it.
|
|
@@ -113,16 +119,25 @@ the command is diagnosed as `sender_not_followed` and writes no trust.
|
|
|
113
119
|
|
|
114
120
|
## Feishu chat information permission
|
|
115
121
|
|
|
116
|
-
Topic
|
|
122
|
+
Topic identity is Feishu's own `thread_id`: a group message carrying one is a
|
|
123
|
+
topic whatever the group's current message format is — a native topic group, an
|
|
124
|
+
ordinary group switched to thread message format, or an ordinary group back in
|
|
125
|
+
chat message format whose old topics members keep talking in. Neither `root_id`
|
|
126
|
+
nor `parent_id` is ever read as identity. What the message format decides is
|
|
127
|
+
only whether a still-unbound topic may automatically receive a new Team, and
|
|
128
|
+
that mutable fact is observed fresh per message, never remembered for the
|
|
129
|
+
session.
|
|
130
|
+
|
|
131
|
+
That observation reads the enclosing chat through Feishu's
|
|
117
132
|
`im.v1.chat.get` API. The bot must have a group information read permission
|
|
118
133
|
accepted by that API, such as `im:chat:readonly`, and must be a member of the
|
|
119
|
-
group. If the API fails or omits a recognized
|
|
120
|
-
warning
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
134
|
+
group. If the API fails or omits a recognized message format, the channel logs
|
|
135
|
+
a warning, keeps the message's identity, and withholds automatic provisioning
|
|
136
|
+
for it: saved bindings still answer — an exact topic binding first, then a
|
|
137
|
+
parent-group binding — and an unbound topic reaches the Dispatcher instead of
|
|
138
|
+
being given a Team. Every non-empty inbound `thread_id` is also included in the
|
|
139
|
+
provider-owned display attributes, so runtimes render it in the model-visible
|
|
140
|
+
`<channel>` envelope.
|
|
126
141
|
|
|
127
142
|
The same read can decide who may answer a card, as a last resort. A click on
|
|
128
143
|
an ask-user or extension card names its chat but not whether that chat is
|
|
@@ -134,16 +149,19 @@ reported by the last admitted inbound message this session routed in that chat
|
|
|
134
149
|
a consumed `/introduce` teaches nothing). Only then does it ask the platform. A person the policy
|
|
135
150
|
admits in a direct chat and in a group alike, or in neither, never triggers the
|
|
136
151
|
read. When the answer does depend on the kind and it cannot be established, the
|
|
137
|
-
click is refused with an error toast rather than
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
152
|
+
click is refused with an error toast rather than admitted on a guess — the
|
|
153
|
+
access kind is the only fact at stake here; a failed message-format read never
|
|
154
|
+
changes what a message is, only whether an unbound topic may provision. On an
|
|
155
|
+
install whose bot lacks the group information read permission, this affects
|
|
156
|
+
only a click in a chat this session has not yet routed an admitted message
|
|
157
|
+
from.
|
|
158
|
+
|
|
159
|
+
A topic target declares its enclosing group as a less-specific binding
|
|
160
|
+
fallback. An exact topic binding wins first, then its parent-group binding,
|
|
161
|
+
and only a still-unbound topic may then be provisioned — one whose group is
|
|
162
|
+
currently in the topic message format and carries a registered Collaboration
|
|
163
|
+
Space policy. If no policy claims it, delivery stays with the Dispatcher.
|
|
164
|
+
This fallback is also
|
|
147
165
|
used for TeamLeader egress authorization after exact message/topic ownership is
|
|
148
166
|
verified, allowing a group-bound TeamLeader to reply to an observed topic
|
|
149
167
|
message without weakening cross-topic authorization for topic-bound leaders.
|
package/dist/extension.d.ts
CHANGED
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
import type { ChannelMcpCaller, DreamuxLogger } from '@excitedjs/dreamux-types';
|
|
13
13
|
import type { FeishuCardActionEvent } from '@excitedjs/feishu-transport';
|
|
14
14
|
import type { FeishuCardActionResponse } from './cards/pairing.js';
|
|
15
|
+
import type { FeishuBoundTeamSubmitOutcome } from './feishu-submit.js';
|
|
15
16
|
import type { FeishuTarget } from './routing/target.js';
|
|
16
17
|
import type { FeishuToolDef, FeishuToolResult } from './tools/types.js';
|
|
17
18
|
export interface FeishuApi {
|
|
@@ -34,7 +35,8 @@ export interface FeishuExtension<S> {
|
|
|
34
35
|
* that instance's state. Local IO only: the bot is not started yet and the
|
|
35
36
|
* core channel contract forbids external IO during initialize. Of
|
|
36
37
|
* `context.api`, only `owner` may be called here; outbound calls (`sendCard`,
|
|
37
|
-
* `editCard`, `readMessageRoute`, `bindTeam`)
|
|
38
|
+
* `editCard`, `readMessageRoute`, `bindTeam`) and input delivery
|
|
39
|
+
* (`submitToBoundTeam`) wait for `start`.
|
|
38
40
|
*/
|
|
39
41
|
initialize(context: FeishuExtensionContext): Promise<S>;
|
|
40
42
|
/**
|
|
@@ -128,6 +130,54 @@ export interface FeishuInstanceApi {
|
|
|
128
130
|
teamName: string;
|
|
129
131
|
display: string;
|
|
130
132
|
}): Promise<void>;
|
|
133
|
+
/**
|
|
134
|
+
* Deliver input to the one Team this conversation still routes to, and
|
|
135
|
+
* answer with what Core said. This is the entry for work an extension does
|
|
136
|
+
* after a click and for input it produces from its own timer — neither needs
|
|
137
|
+
* a card callback, nor any other channel instance, nor a Core port of its
|
|
138
|
+
* own.
|
|
139
|
+
*
|
|
140
|
+
* `expectedTeamName` is both the precondition and the whole recipient set:
|
|
141
|
+
* the conversation must still route to exactly that Team, checked against
|
|
142
|
+
* committed routing (a topic counts its group's binding). Nothing here
|
|
143
|
+
* chooses another recipient, provisions a Team, drops a stale route, or
|
|
144
|
+
* retries. `target` is the address the caller already holds — from `sendCard`
|
|
145
|
+
* or `readMessageRoute` — and it becomes authoritative for the payload's
|
|
146
|
+
* `source`, `chat_id` and `thread_id`; `attrs` add identity and business
|
|
147
|
+
* metadata but cannot replace those.
|
|
148
|
+
*
|
|
149
|
+
* The answer is Core's actual admission result, never a boolean: submitted,
|
|
150
|
+
* duplicate, stopped, failed, ambiguous, a proven pre-admission rejection,
|
|
151
|
+
* or an unknown invocation error. `refused` is different in kind — this
|
|
152
|
+
* Channel proved no Command was sent, either because the instance was
|
|
153
|
+
* already closing (`closed`) or because the binding no longer says what the
|
|
154
|
+
* caller expected (`binding_changed`). Admission is not execution completion
|
|
155
|
+
* and not user receipt.
|
|
156
|
+
*
|
|
157
|
+
* `sourceId` is the identity Core deduplicates on, scoped to the recipient
|
|
158
|
+
* entity: retry one decision with the same id, give different decisions
|
|
159
|
+
* different ids, and an empty id means no deduplication. An omitted
|
|
160
|
+
* `reminder` uses the channel's standing note; an explicit string replaces
|
|
161
|
+
* it, and an empty string deliberately supplies none.
|
|
162
|
+
*
|
|
163
|
+
* This call claims no presentation anchor and opens no pre-admission receipt.
|
|
164
|
+
* Core can still project the input as an ordinary event, which the existing
|
|
165
|
+
* chain-of-thought rules render at whichever anchor already stands — an
|
|
166
|
+
* extension that wants a card of its own repaints it itself.
|
|
167
|
+
*
|
|
168
|
+
* Calls made once the instance begins closing answer `refused/closed` and
|
|
169
|
+
* invoke nothing; a Command already sent stays tracked and still returns its
|
|
170
|
+
* actual outcome, because an abort is not evidence that Core admitted
|
|
171
|
+
* nothing.
|
|
172
|
+
*/
|
|
173
|
+
submitToBoundTeam(input: {
|
|
174
|
+
target: FeishuTarget;
|
|
175
|
+
expectedTeamName: string;
|
|
176
|
+
text: string;
|
|
177
|
+
sourceId: string;
|
|
178
|
+
attrs?: Readonly<Record<string, string>>;
|
|
179
|
+
reminder?: string;
|
|
180
|
+
}): Promise<FeishuBoundTeamSubmitOutcome>;
|
|
131
181
|
/**
|
|
132
182
|
* Send a card and report where Feishu placed it, read off the send
|
|
133
183
|
* response itself. There is no idempotency key: a rejection can mean the
|
package/dist/extension.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extension.d.ts","sourceRoot":"","sources":["../src/extension.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,KAAK,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAChF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AAEzE,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AACnE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,KAAK,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAExE,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,UAAU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AAQ,CAAC,KAAK,EAAE;QACd,MAAM,EAAE,MAAM,CAAC;QACf,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,IAAI,EAAE,OAAO,CAAC;QACd,MAAM,CAAC,EAAE,gBAAgB,CAAC;KAC3B,GAAG,OAAO,CAAC;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,YAAY,CAAA;KAAE,CAAC,CAAC;IACzD,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3D"}
|
|
@@ -10,15 +10,15 @@
|
|
|
10
10
|
*/
|
|
11
11
|
import type { AgentRuntimeInterruptOutcome, JsonInvoker, JsonValue, TeamCreateCommand, TeamSummary } from '@excitedjs/dreamux-types';
|
|
12
12
|
import type { RunningTeamRow } from './cards/running-teams.js';
|
|
13
|
-
import { type
|
|
13
|
+
import { type FeishuCommandSubmitOutcome, type FeishuSubmissionPayload } from './feishu-submit.js';
|
|
14
14
|
export declare class FeishuCoreCommands implements JsonInvoker {
|
|
15
15
|
private invoker;
|
|
16
16
|
initialize(invoker: JsonInvoker): void;
|
|
17
17
|
invoke(command: string, payload: JsonValue): Promise<JsonValue>;
|
|
18
18
|
teamCreate(command: TeamCreateCommand): Promise<TeamSummary>;
|
|
19
19
|
teamStatus(teamName: string): Promise<TeamSummary>;
|
|
20
|
-
teamSubmit(teamName: string, submission:
|
|
21
|
-
dispatcherSubmit(submission:
|
|
20
|
+
teamSubmit(teamName: string, submission: FeishuSubmissionPayload): Promise<FeishuCommandSubmitOutcome>;
|
|
21
|
+
dispatcherSubmit(submission: FeishuSubmissionPayload): Promise<FeishuCommandSubmitOutcome>;
|
|
22
22
|
teamDissolve(input: {
|
|
23
23
|
teamName: string;
|
|
24
24
|
note: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"feishu-core-commands.d.ts","sourceRoot":"","sources":["../src/feishu-core-commands.ts"],"names":[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AAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,4BAA4B,CAAC;IAKtE,mBAAmB,IAAI,OAAO,CAAC,4BAA4B,CAAC;IAM5D,QAAQ,IAAI,OAAO,CAAC,SAAS,cAAc,EAAE,CAAC;CAMrD"}
|
|
@@ -5,7 +5,7 @@ import { commandErrorCode, errorMessage, submitOutcome, } from './feishu-submit.
|
|
|
5
5
|
* the source id Core deduplicates on. `teamSubmit` spreads `team_name` onto
|
|
6
6
|
* this; `dispatcherSubmit` sends it as-is.
|
|
7
7
|
*/
|
|
8
|
-
function
|
|
8
|
+
function submitCommandPayload(submission) {
|
|
9
9
|
return {
|
|
10
10
|
attrs: submission.attrs,
|
|
11
11
|
text: submission.text,
|
|
@@ -53,11 +53,11 @@ export class FeishuCoreCommands {
|
|
|
53
53
|
teamSubmit(teamName, submission) {
|
|
54
54
|
return submitOutcomeFor(this, 'team.submit', {
|
|
55
55
|
team_name: teamName,
|
|
56
|
-
...
|
|
56
|
+
...submitCommandPayload(submission),
|
|
57
57
|
});
|
|
58
58
|
}
|
|
59
59
|
dispatcherSubmit(submission) {
|
|
60
|
-
return submitOutcomeFor(this, 'dispatcher.submit',
|
|
60
|
+
return submitOutcomeFor(this, 'dispatcher.submit', submitCommandPayload(submission));
|
|
61
61
|
}
|
|
62
62
|
async teamDissolve(input) {
|
|
63
63
|
await this.invoke('team.dissolve', {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"feishu-core-commands.js","sourceRoot":"","sources":["../src/feishu-core-commands.ts"],"names":[],"mappings":"AAqBA,OAAO,EACL,gBAAgB,EAChB,YAAY,EACZ,aAAa,GAGd,MAAM,oBAAoB,CAAC;AAE5B;;;;;GAKG;AACH,SAAS,
|
|
1
|
+
{"version":3,"file":"feishu-core-commands.js","sourceRoot":"","sources":["../src/feishu-core-commands.ts"],"names":[],"mappings":"AAqBA,OAAO,EACL,gBAAgB,EAChB,YAAY,EACZ,aAAa,GAGd,MAAM,oBAAoB,C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,MAAM,GAAG,GAAG,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,EAAE,CAAC,CAE9C,CAAC;QACF,OAAO,GAAG,CAAC,KAAK,CAAC;IACnB,CAAC;CACF"}
|
|
@@ -2,7 +2,7 @@ import type { ChannelMcpCaller, ChannelMcpToolRegistration, DreamuxLogger } from
|
|
|
2
2
|
import type { FeishuCardActionEvent } from '@excitedjs/feishu-transport';
|
|
3
3
|
import type { FeishuBot } from './bot.js';
|
|
4
4
|
import type { FeishuExtension, FeishuExtensionActionResult, FeishuExtensionTool, FeishuInstanceApi } from './extension.js';
|
|
5
|
-
import type {
|
|
5
|
+
import type { FeishuCoreCommands } from './feishu-core-commands.js';
|
|
6
6
|
import { type FeishuOutbound } from './outbound/index.js';
|
|
7
7
|
import type { FeishuRouting } from './routing/index.js';
|
|
8
8
|
import type { FeishuBindingOperations } from './routing/operations.js';
|
|
@@ -86,9 +86,9 @@ export declare function buildInstanceApi(input: {
|
|
|
86
86
|
outbound: FeishuOutbound;
|
|
87
87
|
/** Card repaint (`editCard`) reaches the bot directly; see `outbound/index.ts`'s header. */
|
|
88
88
|
bot: Pick<FeishuBot, 'editCard'>;
|
|
89
|
-
targetRouter: Pick<FeishuInboundTargeting, 'project'>;
|
|
90
89
|
routing: FeishuRouting;
|
|
91
90
|
bindings: FeishuBindingOperations;
|
|
91
|
+
commands: FeishuCoreCommands;
|
|
92
92
|
}): FeishuInstanceApi;
|
|
93
93
|
export {};
|
|
94
94
|
//# sourceMappingURL=feishu-extensions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"feishu-extensions.d.ts","sourceRoot":"","sources":["../src/feishu-extensions.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EACV,gBAAgB,EAChB,0BAA0B,EAC1B,aAAa,EACd,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AAEzE,OAAO,KAAK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;YACzE,UAAU;CAkBzB;AAED,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,GAAG,EAAE,mBAAmB,CAAC,OAAO,CAAC,CAAC;IAC3C,MAAM,CAAC,MAAM,EAAE,gBAAgB,EAAE,GAAG,EAAE,OAAO,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;CAC3E;AAkCD;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE;IACtC,SAAS,EAAE,eAAe,CAAC;IAC3B,QAAQ,EAAE,cAAc,CAAC;IACzB,4FAA4F;IAC5F,GAAG,EAAE,IAAI,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;IACjC,OAAO,EAAE,aAAa,CAAC;IACvB,QAAQ,EAAE,uBAAuB,CAAC;IAClC,QAAQ,EAAE,kBAAkB,CAAC;CAC9B,GAAG,iBAAiB,CAiFpB"}
|
|
@@ -9,8 +9,10 @@
|
|
|
9
9
|
*/
|
|
10
10
|
import { join } from 'node:path';
|
|
11
11
|
import { builtinCardAction } from './card-actions.js';
|
|
12
|
+
import { CHANNEL_REMINDER, } from './feishu-submit.js';
|
|
12
13
|
import { agentSender } from './outbound/index.js';
|
|
13
14
|
import { channelPathSegment } from './routing/store.js';
|
|
15
|
+
import { messageTarget } from './routing/target.js';
|
|
14
16
|
import { findFeishuTool, toolRegistration } from './tools/registry.js';
|
|
15
17
|
export class FeishuExtensionRegistry {
|
|
16
18
|
extensions = [];
|
|
@@ -182,6 +184,34 @@ export class FeishuSessionExtensions {
|
|
|
182
184
|
}
|
|
183
185
|
}
|
|
184
186
|
}
|
|
187
|
+
/**
|
|
188
|
+
* Where one extension delivery says its input came from: the checked target's
|
|
189
|
+
* own address, with the caller's metadata underneath it.
|
|
190
|
+
*
|
|
191
|
+
* A caller supplies identity and business fields, but not these three — the
|
|
192
|
+
* operation already holds the conversation it verified, and a caller that
|
|
193
|
+
* overrode `chat_id` or invented a `thread_id` for a conversation that has
|
|
194
|
+
* none would state provenance the Channel knows to be false.
|
|
195
|
+
*
|
|
196
|
+
* The result is built with `Object.fromEntries`, never by assigning onto a
|
|
197
|
+
* plain object: attribute names are an open caller-chosen string set, so an
|
|
198
|
+
* own `__proto__` key is ordinary metadata — the same shape and the same
|
|
199
|
+
* construction Core's own `channel-submission.ts` reader keeps, and one that
|
|
200
|
+
* `canonicalJsonValue` carries across the Command boundary as data.
|
|
201
|
+
*/
|
|
202
|
+
function deliveryAttrs(target, attrs) {
|
|
203
|
+
const fields = [];
|
|
204
|
+
for (const [name, value] of Object.entries(attrs ?? {})) {
|
|
205
|
+
if (name !== 'source' && name !== 'chat_id' && name !== 'thread_id') {
|
|
206
|
+
fields.push([name, value]);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
fields.push(['source', 'feishu'], ['chat_id', target.chatId]);
|
|
210
|
+
if (target.threadId !== undefined) {
|
|
211
|
+
fields.push(['thread_id', target.threadId]);
|
|
212
|
+
}
|
|
213
|
+
return Object.fromEntries(fields);
|
|
214
|
+
}
|
|
185
215
|
/**
|
|
186
216
|
* The instance api for one session lifecycle. `lifecycle` is that session's
|
|
187
217
|
* one liveness value, so every outbound call made after the instance began
|
|
@@ -189,16 +219,17 @@ export class FeishuSessionExtensions {
|
|
|
189
219
|
* check, not a second one re-derived here.
|
|
190
220
|
*/
|
|
191
221
|
export function buildInstanceApi(input) {
|
|
192
|
-
const { lifecycle, outbound, bot,
|
|
222
|
+
const { lifecycle, outbound, bot, routing, bindings, commands } = input;
|
|
193
223
|
return {
|
|
194
224
|
owner(target) {
|
|
195
|
-
|
|
225
|
+
// Binding-only: ownership is a routing-row fact, never permission to
|
|
226
|
+
// provision, which no caller of this check is asking for.
|
|
227
|
+
const plan = routing.plan(target, false);
|
|
196
228
|
return plan.kind === 'bound' ? plan.teamName : null;
|
|
197
229
|
},
|
|
198
230
|
async readMessageRoute(messageId) {
|
|
199
231
|
lifecycle.assertLive();
|
|
200
|
-
|
|
201
|
-
return { target: route.target };
|
|
232
|
+
return { target: await outbound.locate(messageId) };
|
|
202
233
|
},
|
|
203
234
|
async bindTeam({ target, teamName, display }) {
|
|
204
235
|
lifecycle.assertLive();
|
|
@@ -206,6 +237,31 @@ export function buildInstanceApi(input) {
|
|
|
206
237
|
// which must not land after the instance closed its routing store.
|
|
207
238
|
await lifecycle.track(bindings.bindChannel({ target, teamName, display }));
|
|
208
239
|
},
|
|
240
|
+
submitToBoundTeam({ target, expectedTeamName, text, sourceId, attrs, reminder, }) {
|
|
241
|
+
// Checked, captured and invoked in one synchronous turn: nothing between
|
|
242
|
+
// the plan and the Command can run, so the Team the call reaches is the
|
|
243
|
+
// Team this check saw. A binding committed afterwards retargets the next
|
|
244
|
+
// call, never this one. The plan is binding-only (`canProvision=false`):
|
|
245
|
+
// this call delivers to a Team the conversation already routes to and
|
|
246
|
+
// never opens one.
|
|
247
|
+
if (!lifecycle.isLive()) {
|
|
248
|
+
return Promise.resolve({ status: 'refused', reason: 'closed' });
|
|
249
|
+
}
|
|
250
|
+
const plan = routing.plan(target, false);
|
|
251
|
+
if (plan.kind !== 'bound' || plan.teamName !== expectedTeamName) {
|
|
252
|
+
return Promise.resolve({
|
|
253
|
+
status: 'refused',
|
|
254
|
+
reason: 'binding_changed',
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
const submission = {
|
|
258
|
+
attrs: deliveryAttrs(target, attrs),
|
|
259
|
+
text,
|
|
260
|
+
reminder: reminder ?? CHANNEL_REMINDER,
|
|
261
|
+
sourceId,
|
|
262
|
+
};
|
|
263
|
+
return lifecycle.track(commands.teamSubmit(plan.teamName, submission));
|
|
264
|
+
},
|
|
209
265
|
async sendCard({ chatId, replyTo, card, caller }) {
|
|
210
266
|
const sent = await outbound.sendCard({
|
|
211
267
|
target: {
|
|
@@ -219,14 +275,15 @@ export function buildInstanceApi(input) {
|
|
|
219
275
|
if (sentMessage === undefined) {
|
|
220
276
|
throw new Error('Feishu returned no message id for the sent card');
|
|
221
277
|
}
|
|
222
|
-
// Where the card landed, from Feishu's own send response:
|
|
223
|
-
//
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
278
|
+
// Where the card landed, composed from Feishu's own send response:
|
|
279
|
+
// identity only, so no group-format lookup and no format warning.
|
|
280
|
+
return {
|
|
281
|
+
messageId: sentMessage.messageId,
|
|
282
|
+
target: messageTarget({
|
|
283
|
+
chatId: sentMessage.chatId,
|
|
284
|
+
threadId: sentMessage.threadId,
|
|
285
|
+
}),
|
|
286
|
+
};
|
|
230
287
|
},
|
|
231
288
|
async editCard(messageId, card) {
|
|
232
289
|
lifecycle.assertLive();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"feishu-extensions.js","sourceRoot":"","sources":["../src/feishu-extensions.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAUjC,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAQtD,OAAO,EAAE,WAAW,EAAuB,MAAM,qBAAqB,CAAC;AAGvE,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"feishu-extensions.js","sourceRoot":"","sources":["../src/feishu-extensions.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAUjC,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAQtD,OAAO,EACL,gBAAgB,GAEjB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,WAAW,EAAuB,MAAM,qBAAqB,CAAC;AAGvE,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,aAAa,EAAqB,MAAM,qBAAqB,CAAC;AAEvE,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAKvE,MAAM,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C"}
|
package/dist/feishu-submit.d.ts
CHANGED
|
@@ -40,7 +40,17 @@ export declare const DOC_COMMENT_REMINDER: string;
|
|
|
40
40
|
* the only path that carries it.
|
|
41
41
|
*/
|
|
42
42
|
export declare const DOC_COMMENT_COLD_OPEN_REMINDER: string;
|
|
43
|
-
|
|
43
|
+
/**
|
|
44
|
+
* The submission fields one submit Command carries: everything Core reads, and
|
|
45
|
+
* nothing about how this Channel presents the turn.
|
|
46
|
+
*
|
|
47
|
+
* It is separate from `FeishuSubmission` below because presentation and payload
|
|
48
|
+
* are independent axes. The two shapes this Channel produces for ordinary
|
|
49
|
+
* traffic differ only in their presentation branch, and an extension's
|
|
50
|
+
* expected-Team delivery has no presentation branch at all while handing Core
|
|
51
|
+
* the same payload. `FeishuCoreCommands` consumes this shape, never the union.
|
|
52
|
+
*/
|
|
53
|
+
export interface FeishuSubmissionPayload {
|
|
44
54
|
readonly attrs: Readonly<Record<string, string>>;
|
|
45
55
|
readonly text: string;
|
|
46
56
|
readonly reminder: string;
|
|
@@ -56,11 +66,11 @@ interface FeishuSubmissionBase {
|
|
|
56
66
|
* would let a later caller forget the branch and open a chain-of-thought card
|
|
57
67
|
* with nowhere to hang it; a union does not compile.
|
|
58
68
|
*/
|
|
59
|
-
export type FeishuSubmission = (
|
|
69
|
+
export type FeishuSubmission = (FeishuSubmissionPayload & {
|
|
60
70
|
readonly kind: 'chat';
|
|
61
71
|
/** The visible Feishu message this turn's presentation hangs under. */
|
|
62
72
|
readonly anchor: Omit<VisibleMessageAnchor, 'servingTarget'>;
|
|
63
|
-
}) | (
|
|
73
|
+
}) | (FeishuSubmissionPayload & {
|
|
64
74
|
readonly kind: 'doc_comment';
|
|
65
75
|
});
|
|
66
76
|
/** A submission that came from a chat, and therefore carries a visible anchor. */
|
|
@@ -80,7 +90,16 @@ export declare function chatSubmission(input: {
|
|
|
80
90
|
sourceId: string;
|
|
81
91
|
anchor: Omit<VisibleMessageAnchor, 'servingTarget'>;
|
|
82
92
|
}): FeishuChatSubmission;
|
|
83
|
-
|
|
93
|
+
/**
|
|
94
|
+
* What a submit Command itself answers — the subset of `FeishuSubmitOutcome`
|
|
95
|
+
* that comes from Core rather than from this Channel's own provisioning run.
|
|
96
|
+
*
|
|
97
|
+
* It is named once because two callers now produce it: the ordinary submitter
|
|
98
|
+
* and an extension's expected-Team delivery. `team.submit` and
|
|
99
|
+
* `dispatcher.submit` both answer it, and neither may widen it into the
|
|
100
|
+
* provisioning-only `unsubmitted` member below.
|
|
101
|
+
*/
|
|
102
|
+
export type FeishuCommandSubmitOutcome = {
|
|
84
103
|
readonly status: 'submitted';
|
|
85
104
|
readonly turnId: string | null;
|
|
86
105
|
} | {
|
|
@@ -101,6 +120,17 @@ export type FeishuSubmitOutcome = {
|
|
|
101
120
|
readonly code: 'TEAM_NOT_FOUND' | 'TEAM_CLOSED';
|
|
102
121
|
readonly message: string;
|
|
103
122
|
}
|
|
123
|
+
/**
|
|
124
|
+
* Any other failure, including an unknown boundary. Never retried and never
|
|
125
|
+
* re-routed: once Core has been called, a failure proves nothing about
|
|
126
|
+
* whether a turn exists, and this Channel does not deliver a message a
|
|
127
|
+
* second time on a guess.
|
|
128
|
+
*/
|
|
129
|
+
| {
|
|
130
|
+
readonly status: 'error';
|
|
131
|
+
readonly message: string;
|
|
132
|
+
};
|
|
133
|
+
export type FeishuSubmitOutcome = FeishuCommandSubmitOutcome
|
|
104
134
|
/**
|
|
105
135
|
* Automatic provisioning produced no recipient, and `team.submit` was never
|
|
106
136
|
* invoked for this message.
|
|
@@ -114,16 +144,20 @@ export type FeishuSubmitOutcome = {
|
|
|
114
144
|
| {
|
|
115
145
|
readonly status: 'unsubmitted';
|
|
116
146
|
readonly message: string;
|
|
117
|
-
}
|
|
147
|
+
};
|
|
118
148
|
/**
|
|
119
|
-
*
|
|
120
|
-
*
|
|
121
|
-
*
|
|
122
|
-
*
|
|
149
|
+
* What one extension's expected-Team delivery answers.
|
|
150
|
+
*
|
|
151
|
+
* The command outcome, unchanged, or a refusal this Channel made without
|
|
152
|
+
* invoking Core at all: `closed` once the instance began closing, and
|
|
153
|
+
* `binding_changed` when the conversation no longer routes to the expected
|
|
154
|
+
* Team. A refusal therefore proves this operation sent nothing, which no Core
|
|
155
|
+
* answer above establishes — and it is not provisioning's `unsubmitted`, which
|
|
156
|
+
* is a fact about a provisioning run that produced no recipient.
|
|
123
157
|
*/
|
|
124
|
-
| {
|
|
125
|
-
readonly status: '
|
|
126
|
-
readonly
|
|
158
|
+
export type FeishuBoundTeamSubmitOutcome = FeishuCommandSubmitOutcome | {
|
|
159
|
+
readonly status: 'refused';
|
|
160
|
+
readonly reason: 'closed' | 'binding_changed';
|
|
127
161
|
};
|
|
128
162
|
/**
|
|
129
163
|
* What one outcome is, once the question is what a log line owes it.
|
|
@@ -160,7 +194,7 @@ export declare function describeSubmitOutcome(outcome: FeishuSubmitOutcome): Sub
|
|
|
160
194
|
* means here: some outcomes prove the optimistic Channel anchor must be
|
|
161
195
|
* retired, while an ambiguous result proves nothing and leaves it unchanged.
|
|
162
196
|
*/
|
|
163
|
-
export declare function submitOutcome(result: TeamSubmitResult):
|
|
197
|
+
export declare function submitOutcome(result: TeamSubmitResult): FeishuCommandSubmitOutcome;
|
|
164
198
|
export declare function submissionProvesNoAdmission(outcome: FeishuSubmitOutcome): boolean;
|
|
165
199
|
/** Read a rejected Command's code without assuming an error class. */
|
|
166
200
|
export declare function commandErrorCode(error: unknown): string | null;
|
|
@@ -183,7 +217,7 @@ export interface FeishuInboundDelivery {
|
|
|
183
217
|
command(input: {
|
|
184
218
|
command: FeishuSlashCommandInvocation;
|
|
185
219
|
target: FeishuTarget;
|
|
186
|
-
|
|
220
|
+
canProvision: boolean;
|
|
187
221
|
/**
|
|
188
222
|
* The message the command was parsed from. A command whose own effect
|
|
189
223
|
* announces into a conversation with no root of its own yet (a topic
|
|
@@ -200,15 +234,14 @@ export interface FeishuInboundDelivery {
|
|
|
200
234
|
* turned out stale, or the bound Team's TeamLeader. A provisioning run that
|
|
201
235
|
* never produces a Team answers `unsubmitted` (or `rejected` when the
|
|
202
236
|
* just-provisioned Team refuses the submission), and the inbound path posts a
|
|
203
|
-
* failure notice under the triggering message instead. `
|
|
204
|
-
*
|
|
205
|
-
*
|
|
237
|
+
* failure notice under the triggering message instead. `canProvision` is the
|
|
238
|
+
* projection's fresh eligibility observation: only a still-unbound topic in
|
|
239
|
+
* a currently verified topic message format may enter provisioning.
|
|
206
240
|
*/
|
|
207
241
|
deliver(input: {
|
|
208
242
|
target: FeishuTarget;
|
|
209
|
-
|
|
243
|
+
canProvision: boolean;
|
|
210
244
|
submission: FeishuChatSubmission;
|
|
211
245
|
}): Promise<FeishuSubmitOutcome>;
|
|
212
246
|
}
|
|
213
|
-
export {};
|
|
214
247
|
//# sourceMappingURL=feishu-submit.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"feishu-submit.d.ts","sourceRoot":"","sources":["../src/feishu-submit.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,EACV,mBAAmB,EACnB,gBAAgB,EACjB,MAAM,0BAA0B,CAAC;AAElC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,KAAK,EACV,4BAA4B,EAC5B,uBAAuB,EACxB,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAExD;;;;;;;;GAQG;AACH,eAAO,MAAM,gBAAgB,oHACsF,CAAC;AAEpH;;;;;;;;GAQG;AACH,eAAO,MAAM,oBAAoB,QAE4D,CAAC;AAE9F;;;;;;;;GAQG;AACH,eAAO,MAAM,8BAA8B,QAE8D,CAAC;AAE1G,
|
|
1
|
+
{"version":3,"file":"feishu-submit.d.ts","sourceRoot":"","sources":["../src/feishu-submit.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,EACV,mBAAmB,EACnB,gBAAgB,EACj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