@mercury-fw/channel-google-chat 0.2.0 → 0.4.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 +34 -0
- package/dist/google-chat-provider.d.ts +2 -2
- package/google-chat-provider.ts +11 -8
- package/index.ts +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,39 @@
|
|
|
1
1
|
# @mercury-fw/channel-google-chat
|
|
2
2
|
|
|
3
|
+
## 0.4.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 0739f77: A plugin acts as the person Mercury is talking to, who logs in to the service through Mercury.
|
|
8
|
+
|
|
9
|
+
- Plugin contract version 4: a plugin declares `actsAs: "person" | "mercury"`, and one acting as the person contributes a `login`; its tools get the turn's `person` and `requireLogin` in their context.
|
|
10
|
+
- A person is offered only the plugins acting as the person: their prompt fragments, skills and tools. A plugin acting as Mercury, or declaring nothing, is offered on the terminal only until people can be allowed to make Mercury act as itself; the startup log names it.
|
|
11
|
+
- `createCliTool` adds `--user` with the person's id to every command, staged confirmations included, and when the CLI exits with code 3 (not logged in) returns their login instead. `createCliPersonLogin` builds a plugin's `login` on a CLI's two-step remote login. A failed `runCli` carries `exitCode`.
|
|
12
|
+
- Channel contract version 4: channels get `logins` (`accept` a callback URL, `complete` a login) and `detectLoginRequired`.
|
|
13
|
+
- The HTTP channel, with `HTTP_SURFACE_PUBLIC_URL` set, streams a `login` event with the link to open and takes the person back at `GET /login/callback`, public and protected by the single-use state.
|
|
14
|
+
- `mercury.cliCredentials` can declare `userSetup`, run by `mfw credentials setup <plugin> --user-app`: the app people log in through, set up without logging anyone in.
|
|
15
|
+
- plugin-jira and plugin-bitbucket act as the person, on CLIs 2.3.0: set up their people's app with `--user-app` and register `<HTTP_SURFACE_PUBLIC_URL>/login/callback` on it. Jira's skill now says `currentUser()` is the person.
|
|
16
|
+
- plugin-atlassian-admin acts as Mercury, on CLI 0.2.0, whose `init` asks for the key without echoing it: until permissions exist it's available on the terminal only.
|
|
17
|
+
- A third-party plugin needs `apiVersion: 4` to load, and `actsAs: "person"` with a `login` to be offered to people.
|
|
18
|
+
|
|
19
|
+
## 0.3.0
|
|
20
|
+
|
|
21
|
+
### Minor Changes
|
|
22
|
+
|
|
23
|
+
- 521db42: Isolation between the people an agent talks to.
|
|
24
|
+
|
|
25
|
+
- The core keeps one identity per person, `<provider>:<id>`, so two providers issuing the same id are two people. Memory, the conversation archive, the tool log and pending confirmations are keyed on it.
|
|
26
|
+
- The wiki has a common area (`curated/`) everyone reads and an area per person (`users/<key>/`), which the model sees as `personal/`. Listing, reading and grepping reach the common area and the caller's own area, nothing else.
|
|
27
|
+
- Breaking: the model's `write_file` writes only under `personal/notes/`. The new `promote_note` tool copies one of the person's notes into `curated/`, and only once they confirm it with the token.
|
|
28
|
+
- A confirmation can only be confirmed by whoever staged it, in the same session. Its note is written once, in the person's area: a staged note no longer stays "pending" after it's resolved, for ids such as Google Chat's `users/<n>`.
|
|
29
|
+
- Breaking, `@mercury-fw/channel-types`: channel contract 3. `confirm` and `resolveConfirmation` take the caller's `Principal`, and so does every read getter except `manifest` and `health`. Channels written for contract 2 are refused.
|
|
30
|
+
- `@mercury-fw/confirm-engine`: the store's `stage`, `take` and `pending` take the owner's key.
|
|
31
|
+
- Breaking, `@mercury-fw/channel-http`: every read route returns only the caller's data. `/conversation?id=` takes one of the caller's `conversationId`s and `/conversations` lists them by `conversationId`. `/wiki/read` answers `404` outside what the caller can see, and `/memory/scroll` answers `400` for a collection that isn't kept per person.
|
|
32
|
+
- `@mercury-fw/channel-google-chat`: on channel contract 3.
|
|
33
|
+
- At startup, an instance's existing data moves to the new layout. Google Chat and terminal notes go into their areas, and Qdrant's ids go onto the new keys. Ids that don't say which provider they came from are left in place and logged.
|
|
34
|
+
- `mfw vault read` refuses a path outside the vault.
|
|
35
|
+
- The admin panel's wiki box edits the common area with the operator's tools (list, read, grep, `write_curated`), the same the nightly review uses.
|
|
36
|
+
|
|
3
37
|
## 0.2.0
|
|
4
38
|
|
|
5
39
|
### Minor Changes
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
*/
|
|
22
22
|
import { sendMessage, sendCard, updateCard, getOrCreateDmSpace, type ServiceAccountCredentials, type TokenSource } from "./google-chat-app-client.ts";
|
|
23
23
|
import { type PubSubSubscription } from "./google-chat-pubsub-stream.ts";
|
|
24
|
-
import { type Provider } from "@mercury-fw/channel-types";
|
|
24
|
+
import { type Provider, type Principal } from "@mercury-fw/channel-types";
|
|
25
25
|
/**
|
|
26
26
|
* Composite session key: space + sender. Deliberately does NOT include
|
|
27
27
|
* `thread` — confirmed live (two consecutive messages in the same DM
|
|
@@ -69,7 +69,7 @@ export type GoogleChatProviderDeps = {
|
|
|
69
69
|
* the channel's contact with confirmation — the store, vault and note-writer
|
|
70
70
|
* stay in the core.
|
|
71
71
|
*/
|
|
72
|
-
confirm: (token: string, sessionKey: string,
|
|
72
|
+
confirm: (token: string, sessionKey: string, principal: Principal) => Promise<string | null>;
|
|
73
73
|
/**
|
|
74
74
|
* Handles a `CARD_CLICKED` event's action parameters. Defaults to resolving
|
|
75
75
|
* the confirm button's token through `deps.confirm` (the same path a bare
|
package/google-chat-provider.ts
CHANGED
|
@@ -40,6 +40,7 @@ import {
|
|
|
40
40
|
type Provider,
|
|
41
41
|
type HandleTurn,
|
|
42
42
|
type TurnSink,
|
|
43
|
+
type Principal,
|
|
43
44
|
} from "@mercury-fw/channel-types";
|
|
44
45
|
|
|
45
46
|
/**
|
|
@@ -257,7 +258,7 @@ export type GoogleChatProviderDeps = {
|
|
|
257
258
|
* the channel's contact with confirmation — the store, vault and note-writer
|
|
258
259
|
* stay in the core.
|
|
259
260
|
*/
|
|
260
|
-
confirm: (token: string, sessionKey: string,
|
|
261
|
+
confirm: (token: string, sessionKey: string, principal: Principal) => Promise<string | null>;
|
|
261
262
|
/**
|
|
262
263
|
* Handles a `CARD_CLICKED` event's action parameters. Defaults to resolving
|
|
263
264
|
* the confirm button's token through `deps.confirm` (the same path a bare
|
|
@@ -315,7 +316,7 @@ export function createGoogleChatProvider(deps: GoogleChatProviderDeps): GoogleCh
|
|
|
315
316
|
log(`[chat] card click with no token parameter`);
|
|
316
317
|
return;
|
|
317
318
|
}
|
|
318
|
-
const reply = await deps.confirm(token, deriveSessionKey(space, sender), sender);
|
|
319
|
+
const reply = await deps.confirm(token, deriveSessionKey(space, sender), { id: sender, provider: "google-chat" });
|
|
319
320
|
if (reply !== null) {
|
|
320
321
|
log(`[chat:${space}] [out] ${reply}`);
|
|
321
322
|
const sent = await sendMessageFn(space, reply, clientDeps);
|
|
@@ -478,7 +479,13 @@ export function createGoogleChatProvider(deps: GoogleChatProviderDeps): GoogleCh
|
|
|
478
479
|
const sessionKey = deriveSessionKey(event.space, event.sender);
|
|
479
480
|
const markedInput = event.senderDisplayName ? `[Da: ${event.senderDisplayName}]\n${event.text}` : event.text;
|
|
480
481
|
|
|
481
|
-
const
|
|
482
|
+
const principal: Principal = {
|
|
483
|
+
id: event.sender,
|
|
484
|
+
provider: "google-chat",
|
|
485
|
+
...(event.senderDisplayName ? { displayName: event.senderDisplayName } : {}),
|
|
486
|
+
};
|
|
487
|
+
|
|
488
|
+
const confirmReply = await deps.confirm(event.text, sessionKey, principal);
|
|
482
489
|
if (confirmReply !== null) {
|
|
483
490
|
log(`[chat:${event.space}] [out] ${confirmReply}`);
|
|
484
491
|
const sent = await sendMessageFn(event.space, confirmReply, clientDeps);
|
|
@@ -505,11 +512,7 @@ export function createGoogleChatProvider(deps: GoogleChatProviderDeps): GoogleCh
|
|
|
505
512
|
multiUser: !event.isDirectMessage,
|
|
506
513
|
text: markedInput,
|
|
507
514
|
sessionKey,
|
|
508
|
-
principal
|
|
509
|
-
id: event.sender,
|
|
510
|
-
provider: "google-chat",
|
|
511
|
-
...(event.senderDisplayName ? { displayName: event.senderDisplayName } : {}),
|
|
512
|
-
},
|
|
515
|
+
principal,
|
|
513
516
|
logPrefix: `[chat:${event.space}:${event.sender}] `,
|
|
514
517
|
},
|
|
515
518
|
sink,
|
package/index.ts
CHANGED
|
@@ -22,7 +22,7 @@ function require(env: ChannelRuntimeContext["env"], name: string): string {
|
|
|
22
22
|
export const googleChatChannel: ChannelPlugin = {
|
|
23
23
|
// The contract this channel is written for, as a literal: importing
|
|
24
24
|
// CHANNEL_API_VERSION would report whichever contract is installed.
|
|
25
|
-
apiVersion:
|
|
25
|
+
apiVersion: 4,
|
|
26
26
|
name: "google-chat",
|
|
27
27
|
build: (ctx) => {
|
|
28
28
|
// No subscription configured ⇒ this instance simply doesn't run Google Chat.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mercury-fw/channel-google-chat",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -31,10 +31,10 @@
|
|
|
31
31
|
"@google-cloud/pubsub": "^5.3.1"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
|
-
"@mercury-fw/channel-types": ">=0.
|
|
34
|
+
"@mercury-fw/channel-types": ">=0.36.0 <1.0.0"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@mercury-fw/channel-types": "0.
|
|
37
|
+
"@mercury-fw/channel-types": "0.40.0",
|
|
38
38
|
"@mercury-fw/typescript-config": "*",
|
|
39
39
|
"@types/bun": "^1.4.2",
|
|
40
40
|
"typescript": "^6.0.3"
|