@opengeni/api-router 2.3.2-canary.2 → 2.5.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/dist/app.js +1 -1
- package/dist/auth/managed-auth-attempt-context.d.ts +4 -0
- package/dist/auth/managed-auth-session-adapter.d.ts +4 -0
- package/dist/{chunk-IBV7Z6F4.js → chunk-QESX7HDK.js} +3645 -470
- package/dist/chunk-QESX7HDK.js.map +1 -0
- package/dist/fatal-process-boundary.d.ts +25 -0
- package/dist/http/sse.d.ts +2 -0
- package/dist/index.d.ts +5 -1
- package/dist/index.js +168 -6
- package/dist/index.js.map +1 -1
- package/dist/integrations/slack-interactions.d.ts +1 -1
- package/dist/mcp/receipts.d.ts +9 -0
- package/dist/mcp/server.d.ts +33 -0
- package/dist/organization-recovery-notifications.d.ts +41 -0
- package/dist/routes/managed-auth-session-sets.d.ts +19 -0
- package/dist/routes/organization-recovery.d.ts +19 -0
- package/dist/routes/sessions.d.ts +17 -5
- package/dist/routes/workspaces.d.ts +1 -0
- package/dist/work-discovery-observability.d.ts +33 -0
- package/package.json +18 -18
- package/src/app.ts +133 -1
- package/src/auth/managed-auth-attempt-context.ts +24 -0
- package/src/auth/managed-auth-session-adapter.ts +205 -0
- package/src/auth/managed-auth.ts +52 -2
- package/src/fatal-process-boundary.ts +231 -0
- package/src/http/sse.ts +7 -0
- package/src/index.ts +25 -5
- package/src/integrations/slack-interactions.ts +30 -17
- package/src/mcp/receipts.ts +34 -0
- package/src/mcp/server.ts +349 -68
- package/src/organization-recovery-notifications.ts +103 -0
- package/src/routes/canonical-human-identities.ts +29 -14
- package/src/routes/codex.ts +5 -1
- package/src/routes/environments.ts +23 -0
- package/src/routes/interaction-resources.ts +3 -0
- package/src/routes/managed-auth-session-sets.ts +994 -0
- package/src/routes/managed-onboarding.ts +2 -0
- package/src/routes/organization-memberships.ts +2 -0
- package/src/routes/organization-recovery.ts +325 -0
- package/src/routes/sessions.ts +401 -120
- package/src/routes/supergrok.ts +5 -1
- package/src/routes/workspaces.ts +23 -1
- package/src/work-discovery-observability.ts +121 -0
- package/dist/chunk-IBV7Z6F4.js.map +0 -1
|
@@ -3203,13 +3203,15 @@ async function continueSlackSession(
|
|
|
3203
3203
|
respondedBy: grant.subjectId,
|
|
3204
3204
|
clientEventId: `slack:${entry.providerEventId}`,
|
|
3205
3205
|
});
|
|
3206
|
-
if (accepted.action === "accepted") {
|
|
3207
|
-
|
|
3208
|
-
|
|
3209
|
-
|
|
3210
|
-
|
|
3211
|
-
|
|
3212
|
-
|
|
3206
|
+
if (accepted.action === "accepted" || accepted.action === "completed") {
|
|
3207
|
+
if (accepted.events.length > 0) {
|
|
3208
|
+
await publishDurableSessionEvents(
|
|
3209
|
+
deps.bus,
|
|
3210
|
+
grant.workspaceId,
|
|
3211
|
+
interaction.sessionId,
|
|
3212
|
+
accepted.events,
|
|
3213
|
+
);
|
|
3214
|
+
}
|
|
3213
3215
|
if (accepted.workflowWakeRevision !== null) {
|
|
3214
3216
|
await deps.workflowClient.signalApprovalDecision({
|
|
3215
3217
|
accountId: grant.accountId,
|
|
@@ -3220,7 +3222,8 @@ async function continueSlackSession(
|
|
|
3220
3222
|
workflowWakeRevision: accepted.workflowWakeRevision,
|
|
3221
3223
|
});
|
|
3222
3224
|
}
|
|
3223
|
-
|
|
3225
|
+
const committedOutcome = accepted.request.response?.outcome;
|
|
3226
|
+
if (committedOutcome === "answered" || committedOutcome === "skipped") return;
|
|
3224
3227
|
}
|
|
3225
3228
|
}
|
|
3226
3229
|
}
|
|
@@ -3502,19 +3505,21 @@ async function executeSlackAction(
|
|
|
3502
3505
|
respondedBy: grant.subjectId,
|
|
3503
3506
|
clientEventId: `slack-action:${handle.id}`,
|
|
3504
3507
|
});
|
|
3505
|
-
if (accepted.action
|
|
3508
|
+
if (accepted.action === "not_found" || accepted.action === "conflict") {
|
|
3506
3509
|
return {
|
|
3507
3510
|
result: "stale",
|
|
3508
3511
|
stale: true,
|
|
3509
3512
|
text: `${mention}This question is no longer pending.`,
|
|
3510
3513
|
};
|
|
3511
3514
|
}
|
|
3512
|
-
|
|
3513
|
-
|
|
3514
|
-
|
|
3515
|
-
|
|
3516
|
-
|
|
3517
|
-
|
|
3515
|
+
if (accepted.events.length > 0) {
|
|
3516
|
+
await publishDurableSessionEvents(
|
|
3517
|
+
deps.bus,
|
|
3518
|
+
grant.workspaceId,
|
|
3519
|
+
handle.sessionId,
|
|
3520
|
+
accepted.events,
|
|
3521
|
+
);
|
|
3522
|
+
}
|
|
3518
3523
|
if (accepted.workflowWakeRevision !== null) {
|
|
3519
3524
|
await deps.workflowClient.signalApprovalDecision({
|
|
3520
3525
|
accountId: grant.accountId,
|
|
@@ -3525,9 +3530,17 @@ async function executeSlackAction(
|
|
|
3525
3530
|
workflowWakeRevision: accepted.workflowWakeRevision,
|
|
3526
3531
|
});
|
|
3527
3532
|
}
|
|
3533
|
+
const committedOutcome = accepted.request.response?.outcome ?? response.outcome;
|
|
3534
|
+
if (committedOutcome !== "answered" && committedOutcome !== "skipped") {
|
|
3535
|
+
return {
|
|
3536
|
+
result: "stale",
|
|
3537
|
+
stale: true,
|
|
3538
|
+
text: `${mention}This question is already ${committedOutcome}.`,
|
|
3539
|
+
};
|
|
3540
|
+
}
|
|
3528
3541
|
return {
|
|
3529
|
-
result:
|
|
3530
|
-
text: `${mention}${
|
|
3542
|
+
result: committedOutcome === "skipped" ? "skipped" : "answered",
|
|
3543
|
+
text: `${mention}${committedOutcome === "skipped" ? "Skipped the question" : "Answer submitted"}. OpenGeni will continue.`,
|
|
3531
3544
|
};
|
|
3532
3545
|
}
|
|
3533
3546
|
if (handle.actionKind === "session_pause" || handle.actionKind === "session_resume") {
|
package/src/mcp/receipts.ts
CHANGED
|
@@ -26,6 +26,40 @@ export function mcpMutationReceipt(input: McpMutationReceiptInput): McpMutationR
|
|
|
26
26
|
});
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
+
export function sessionControlMutationReceipt(input: {
|
|
30
|
+
operation: "session_pause" | "session_resume";
|
|
31
|
+
sessionId: string;
|
|
32
|
+
state: string;
|
|
33
|
+
receiptId: string;
|
|
34
|
+
timestamp: string;
|
|
35
|
+
outcome: "changed" | "unchanged" | "replayed";
|
|
36
|
+
interruptionCount: number;
|
|
37
|
+
}): McpMutationReceiptType {
|
|
38
|
+
return mcpMutationReceipt({
|
|
39
|
+
operation: input.operation,
|
|
40
|
+
committed: true,
|
|
41
|
+
outcome:
|
|
42
|
+
input.outcome === "changed"
|
|
43
|
+
? "updated"
|
|
44
|
+
: input.outcome === "unchanged"
|
|
45
|
+
? "unchanged"
|
|
46
|
+
: "replayed",
|
|
47
|
+
changed: input.outcome === "changed",
|
|
48
|
+
resource: {
|
|
49
|
+
type: "session",
|
|
50
|
+
id: input.sessionId,
|
|
51
|
+
state: input.state,
|
|
52
|
+
},
|
|
53
|
+
relatedResources: [{ type: "session_command_receipt", id: input.receiptId }],
|
|
54
|
+
timestamp: input.timestamp,
|
|
55
|
+
idempotency: {
|
|
56
|
+
status: input.outcome === "replayed" ? "replayed" : "applied",
|
|
57
|
+
},
|
|
58
|
+
facts: { interruptionCount: input.interruptionCount },
|
|
59
|
+
nextAction: { tool: "session_get", arguments: { sessionId: input.sessionId } },
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
|
|
29
63
|
export type SessionCreateReceiptResult = {
|
|
30
64
|
session: {
|
|
31
65
|
id: string;
|