@openscout/protocol 0.3.0 → 0.3.1
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/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/integrations.d.ts +106 -0
- package/dist/integrations.d.ts.map +1 -0
- package/dist/integrations.js +1 -0
- package/dist/slack-manifest.d.ts +2 -0
- package/dist/slack-manifest.d.ts.map +1 -0
- package/dist/slack-manifest.js +58 -0
- package/package.json +2 -2
- package/src/index.ts +3 -0
- package/src/integrations.ts +86 -0
- package/src/slack-manifest.ts +59 -0
package/dist/index.d.ts
CHANGED
|
@@ -67,4 +67,6 @@ export * from "./chat-message-corrections.js";
|
|
|
67
67
|
export * from "./chat-mentions.js";
|
|
68
68
|
export * from "./agent-notifications.js";
|
|
69
69
|
export * from "./mcp-core-tools.js";
|
|
70
|
+
export * from "./integrations.js";
|
|
71
|
+
export * from "./slack-manifest.js";
|
|
70
72
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,qBAAqB,CAAC;AACpC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,UAAU,CAAC;AACzB,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qB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C;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC;AACrC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,oBAAoB,CAAC;AACnC,cAAc,0BAA0B,CAAC;AACzC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,0BAA0B,CAAC;AACzC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAEhC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,+BAA+B,CAAC;AAE9C,cAAc,oBAAoB,CAAC;AAEnC,cAAc,0BAA0B,CAAC;AAEzC,cAAc,qBAAqB,CAAC;AAEpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/** Token-free contracts for broker-owned, local Slack setup. */
|
|
2
|
+
export type SlackSetupState = "awaiting_workspace" | "awaiting_authority" | "awaiting_app" | "awaiting_credentials" | "ready_to_start";
|
|
3
|
+
export interface SlackProjectBinding {
|
|
4
|
+
agentId: string;
|
|
5
|
+
definitionId: string;
|
|
6
|
+
projectPath: string;
|
|
7
|
+
nodeId: string;
|
|
8
|
+
revision: number;
|
|
9
|
+
}
|
|
10
|
+
export interface SlackSetupRequest {
|
|
11
|
+
provider: "slack";
|
|
12
|
+
mode: "project_agent";
|
|
13
|
+
projectPath: string;
|
|
14
|
+
agentId?: string;
|
|
15
|
+
displayName?: string;
|
|
16
|
+
workspaceId?: string;
|
|
17
|
+
idempotencyKey?: string;
|
|
18
|
+
}
|
|
19
|
+
export interface SlackCredentialReference {
|
|
20
|
+
backend: "secret_cli" | "private_file";
|
|
21
|
+
appTokenKey: string;
|
|
22
|
+
botTokenKey: string;
|
|
23
|
+
}
|
|
24
|
+
export interface SlackInstallationCredentials {
|
|
25
|
+
reference: SlackCredentialReference;
|
|
26
|
+
botId: string;
|
|
27
|
+
botUserId: string;
|
|
28
|
+
verifiedAt: number;
|
|
29
|
+
allowedUserIds: string[];
|
|
30
|
+
allowedChannelIds: string[];
|
|
31
|
+
}
|
|
32
|
+
export interface SlackVerificationEvidence {
|
|
33
|
+
bindingRevision: number;
|
|
34
|
+
credentialVerifiedAt: number;
|
|
35
|
+
verifiedAt: number;
|
|
36
|
+
channelId: string;
|
|
37
|
+
threadTs: string;
|
|
38
|
+
first: {
|
|
39
|
+
eventId: string;
|
|
40
|
+
invocationId: string;
|
|
41
|
+
messageId: string;
|
|
42
|
+
resultDeliveredAt: number;
|
|
43
|
+
};
|
|
44
|
+
followUp: {
|
|
45
|
+
eventId: string;
|
|
46
|
+
invocationId: string;
|
|
47
|
+
messageId: string;
|
|
48
|
+
resultDeliveredAt: number;
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
export interface SlackSetupOperation {
|
|
52
|
+
id: string;
|
|
53
|
+
provider: "slack";
|
|
54
|
+
mode: "project_agent";
|
|
55
|
+
ownerRealmId: string;
|
|
56
|
+
binding: SlackProjectBinding;
|
|
57
|
+
displayName: string;
|
|
58
|
+
manifestHash: string;
|
|
59
|
+
workspaceId?: string;
|
|
60
|
+
/** Claimed by the operator; not yet validated with Slack. */
|
|
61
|
+
appId?: string;
|
|
62
|
+
authorityConfirmedAt?: number;
|
|
63
|
+
credentials?: SlackInstallationCredentials;
|
|
64
|
+
desiredState?: "running" | "paused" | "disconnected";
|
|
65
|
+
verification?: SlackVerificationEvidence;
|
|
66
|
+
workerError?: {
|
|
67
|
+
code: "worker_unavailable" | "worker_exited";
|
|
68
|
+
at: number;
|
|
69
|
+
};
|
|
70
|
+
state: SlackSetupState;
|
|
71
|
+
revision: number;
|
|
72
|
+
createdAt: number;
|
|
73
|
+
updatedAt: number;
|
|
74
|
+
}
|
|
75
|
+
export type SlackSetupResumeRequest = {
|
|
76
|
+
expectedRevision: number;
|
|
77
|
+
} & ({
|
|
78
|
+
action: "choose_workspace";
|
|
79
|
+
workspaceId: string;
|
|
80
|
+
} | {
|
|
81
|
+
action: "confirm_authority";
|
|
82
|
+
} | {
|
|
83
|
+
action: "register_app";
|
|
84
|
+
appId: string;
|
|
85
|
+
});
|
|
86
|
+
export interface SlackSetupReceipt {
|
|
87
|
+
operation: SlackSetupOperation;
|
|
88
|
+
nextAction: {
|
|
89
|
+
id: string;
|
|
90
|
+
kind: "choose_workspace" | "confirm_authority" | "create_or_connect_app" | "connect_secrets" | "start_worker" | "wait_for_worker" | "verify_integration" | "complete";
|
|
91
|
+
title: string;
|
|
92
|
+
};
|
|
93
|
+
/** Setup bookkeeping never implies a connected or verified integration. */
|
|
94
|
+
readiness: "not_connected" | "connected_unverified" | "verified";
|
|
95
|
+
eventQueue?: {
|
|
96
|
+
pending: number;
|
|
97
|
+
retrying: number;
|
|
98
|
+
};
|
|
99
|
+
worker?: {
|
|
100
|
+
generation: number;
|
|
101
|
+
state: "starting" | "connected" | "stopped" | "expired";
|
|
102
|
+
expiresAt: number;
|
|
103
|
+
updatedAt: number;
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
//# sourceMappingURL=integrations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"integrations.d.ts","sourceRoot":"","sources":["../src/integrations.ts"],"names":[],"mappings":"AAAA,gEAAgE;AAChE,MAAM,MAAM,eAAe,GAAG,oBAAoB,GAAG,oBAA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QACV,EAAE,EAAE,MAAM,CAAC;QACX,IAAI,EAAE,kBAAkB,GAAG,mBAAmB,GAAG,uBAAuB,GAAG,iBAAiB,GAAG,cAAc,GAAG,iBAAiB,GAAG,oBAAoB,GAAG,UAAU,CAAC;QACtK,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;IACF,2EAA2E;IAC3E,SAAS,EAAE,eAAe,GAAG,sBAAsB,GAAG,UAAU,CAAC;IACjE,UAAU,CAAC,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC;IACnD,MAAM,CAAC,EAAE;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,UAAU,GAAG,WAAW,GAAG,SAAS,GAAG,SAAS,CAAC;QAAC,SAAS,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC;CAChI"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slack-manifest.d.ts","sourceRoot":"","sources":["../src/slack-manifest.ts"],"names":[],"mappings":"AAAA,wBAAgB,gBAAgB,CAAC,OAAO,SAAU,EAAE,IAAI,GAAE,SAAS,GAAG,SAAqB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAyDpH"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
export function slackAppManifest(appName = "Scout", mode = "generic") {
|
|
2
|
+
return {
|
|
3
|
+
display_information: {
|
|
4
|
+
name: appName,
|
|
5
|
+
description: mode === "project" ? `Reach the ${appName} project agent through Scout` : "Turn Slack requests into durable Scout coding work",
|
|
6
|
+
background_color: "#171717",
|
|
7
|
+
},
|
|
8
|
+
features: {
|
|
9
|
+
app_home: {
|
|
10
|
+
home_tab_enabled: false,
|
|
11
|
+
messages_tab_enabled: true,
|
|
12
|
+
messages_tab_read_only_enabled: false,
|
|
13
|
+
},
|
|
14
|
+
bot_user: {
|
|
15
|
+
display_name: appName,
|
|
16
|
+
always_online: false,
|
|
17
|
+
},
|
|
18
|
+
...(mode === "generic" ? { slash_commands: [
|
|
19
|
+
{
|
|
20
|
+
command: "/scout",
|
|
21
|
+
description: "Start Scout work, optionally routed to a target or exact session",
|
|
22
|
+
usage_hint: "[@target|session:<id>] request",
|
|
23
|
+
should_escape: false,
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
command: "/scout-settings",
|
|
27
|
+
description: "Set the default project, branch, and harness for this channel",
|
|
28
|
+
should_escape: false,
|
|
29
|
+
},
|
|
30
|
+
] } : {}),
|
|
31
|
+
},
|
|
32
|
+
oauth_config: {
|
|
33
|
+
scopes: {
|
|
34
|
+
bot: [
|
|
35
|
+
"app_mentions:read",
|
|
36
|
+
"channels:history",
|
|
37
|
+
"chat:write",
|
|
38
|
+
"files:read",
|
|
39
|
+
"groups:history",
|
|
40
|
+
"im:history",
|
|
41
|
+
"mpim:history",
|
|
42
|
+
"reactions:write",
|
|
43
|
+
"users:read",
|
|
44
|
+
...(mode === "generic" ? ["commands"] : []),
|
|
45
|
+
],
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
settings: {
|
|
49
|
+
event_subscriptions: {
|
|
50
|
+
bot_events: ["app_mention", "message.im"],
|
|
51
|
+
},
|
|
52
|
+
interactivity: { is_enabled: true },
|
|
53
|
+
org_deploy_enabled: false,
|
|
54
|
+
socket_mode_enabled: true,
|
|
55
|
+
token_rotation_enabled: false,
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openscout/protocol",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "Typed protocol for the OpenScout local control plane",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -57,5 +57,5 @@
|
|
|
57
57
|
"devDependencies": {
|
|
58
58
|
"typescript": "^5"
|
|
59
59
|
},
|
|
60
|
-
"gitHead": "
|
|
60
|
+
"gitHead": "acc338aab0a2df4d88051822280d8156b99bb120"
|
|
61
61
|
}
|
package/src/index.ts
CHANGED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/** Token-free contracts for broker-owned, local Slack setup. */
|
|
2
|
+
export type SlackSetupState = "awaiting_workspace" | "awaiting_authority" | "awaiting_app" | "awaiting_credentials" | "ready_to_start";
|
|
3
|
+
|
|
4
|
+
export interface SlackProjectBinding {
|
|
5
|
+
agentId: string;
|
|
6
|
+
definitionId: string;
|
|
7
|
+
projectPath: string;
|
|
8
|
+
nodeId: string;
|
|
9
|
+
revision: number;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface SlackSetupRequest {
|
|
13
|
+
provider: "slack";
|
|
14
|
+
mode: "project_agent";
|
|
15
|
+
projectPath: string;
|
|
16
|
+
agentId?: string;
|
|
17
|
+
displayName?: string;
|
|
18
|
+
workspaceId?: string;
|
|
19
|
+
idempotencyKey?: string;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface SlackCredentialReference {
|
|
23
|
+
backend: "secret_cli" | "private_file";
|
|
24
|
+
appTokenKey: string;
|
|
25
|
+
botTokenKey: string;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface SlackInstallationCredentials {
|
|
29
|
+
reference: SlackCredentialReference;
|
|
30
|
+
botId: string;
|
|
31
|
+
botUserId: string;
|
|
32
|
+
verifiedAt: number;
|
|
33
|
+
allowedUserIds: string[];
|
|
34
|
+
allowedChannelIds: string[];
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface SlackVerificationEvidence {
|
|
38
|
+
bindingRevision: number;
|
|
39
|
+
credentialVerifiedAt: number;
|
|
40
|
+
verifiedAt: number;
|
|
41
|
+
channelId: string;
|
|
42
|
+
threadTs: string;
|
|
43
|
+
first: { eventId: string; invocationId: string; messageId: string; resultDeliveredAt: number };
|
|
44
|
+
followUp: { eventId: string; invocationId: string; messageId: string; resultDeliveredAt: number };
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export interface SlackSetupOperation {
|
|
48
|
+
id: string;
|
|
49
|
+
provider: "slack";
|
|
50
|
+
mode: "project_agent";
|
|
51
|
+
ownerRealmId: string;
|
|
52
|
+
binding: SlackProjectBinding;
|
|
53
|
+
displayName: string;
|
|
54
|
+
manifestHash: string;
|
|
55
|
+
workspaceId?: string;
|
|
56
|
+
/** Claimed by the operator; not yet validated with Slack. */
|
|
57
|
+
appId?: string;
|
|
58
|
+
authorityConfirmedAt?: number;
|
|
59
|
+
credentials?: SlackInstallationCredentials;
|
|
60
|
+
desiredState?: "running" | "paused" | "disconnected";
|
|
61
|
+
verification?: SlackVerificationEvidence;
|
|
62
|
+
workerError?: { code: "worker_unavailable" | "worker_exited"; at: number };
|
|
63
|
+
state: SlackSetupState;
|
|
64
|
+
revision: number;
|
|
65
|
+
createdAt: number;
|
|
66
|
+
updatedAt: number;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export type SlackSetupResumeRequest = { expectedRevision: number } & (
|
|
70
|
+
| { action: "choose_workspace"; workspaceId: string }
|
|
71
|
+
| { action: "confirm_authority" }
|
|
72
|
+
| { action: "register_app"; appId: string }
|
|
73
|
+
);
|
|
74
|
+
|
|
75
|
+
export interface SlackSetupReceipt {
|
|
76
|
+
operation: SlackSetupOperation;
|
|
77
|
+
nextAction: {
|
|
78
|
+
id: string;
|
|
79
|
+
kind: "choose_workspace" | "confirm_authority" | "create_or_connect_app" | "connect_secrets" | "start_worker" | "wait_for_worker" | "verify_integration" | "complete";
|
|
80
|
+
title: string;
|
|
81
|
+
};
|
|
82
|
+
/** Setup bookkeeping never implies a connected or verified integration. */
|
|
83
|
+
readiness: "not_connected" | "connected_unverified" | "verified";
|
|
84
|
+
eventQueue?: { pending: number; retrying: number };
|
|
85
|
+
worker?: { generation: number; state: "starting" | "connected" | "stopped" | "expired"; expiresAt: number; updatedAt: number };
|
|
86
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
export function slackAppManifest(appName = "Scout", mode: "generic" | "project" = "generic"): Record<string, unknown> {
|
|
2
|
+
return {
|
|
3
|
+
display_information: {
|
|
4
|
+
name: appName,
|
|
5
|
+
description: mode === "project" ? `Reach the ${appName} project agent through Scout` : "Turn Slack requests into durable Scout coding work",
|
|
6
|
+
background_color: "#171717",
|
|
7
|
+
},
|
|
8
|
+
features: {
|
|
9
|
+
app_home: {
|
|
10
|
+
home_tab_enabled: false,
|
|
11
|
+
messages_tab_enabled: true,
|
|
12
|
+
messages_tab_read_only_enabled: false,
|
|
13
|
+
},
|
|
14
|
+
bot_user: {
|
|
15
|
+
display_name: appName,
|
|
16
|
+
always_online: false,
|
|
17
|
+
},
|
|
18
|
+
...(mode === "generic" ? { slash_commands: [
|
|
19
|
+
{
|
|
20
|
+
command: "/scout",
|
|
21
|
+
description: "Start Scout work, optionally routed to a target or exact session",
|
|
22
|
+
usage_hint: "[@target|session:<id>] request",
|
|
23
|
+
should_escape: false,
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
command: "/scout-settings",
|
|
27
|
+
description: "Set the default project, branch, and harness for this channel",
|
|
28
|
+
should_escape: false,
|
|
29
|
+
},
|
|
30
|
+
] } : {}),
|
|
31
|
+
},
|
|
32
|
+
oauth_config: {
|
|
33
|
+
scopes: {
|
|
34
|
+
bot: [
|
|
35
|
+
"app_mentions:read",
|
|
36
|
+
"channels:history",
|
|
37
|
+
"chat:write",
|
|
38
|
+
"files:read",
|
|
39
|
+
"groups:history",
|
|
40
|
+
"im:history",
|
|
41
|
+
"mpim:history",
|
|
42
|
+
"reactions:write",
|
|
43
|
+
"users:read",
|
|
44
|
+
...(mode === "generic" ? ["commands"] : []),
|
|
45
|
+
],
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
settings: {
|
|
49
|
+
event_subscriptions: {
|
|
50
|
+
bot_events: ["app_mention", "message.im"],
|
|
51
|
+
},
|
|
52
|
+
interactivity: { is_enabled: true },
|
|
53
|
+
org_deploy_enabled: false,
|
|
54
|
+
socket_mode_enabled: true,
|
|
55
|
+
token_rotation_enabled: false,
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
|