@processfocus/runtime-local 0.1.0-next.3 → 0.1.0-next.4
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 +3 -0
- package/dist/authentication-server.mjs +3 -3
- package/dist/{chunk-bg5r4wpv.js → chunk-3wzp2sax.js} +168 -117
- package/dist/{chunk-cbd36jq1.js → chunk-5kjvzbwr.js} +1 -1
- package/dist/{chunk-727y6qkb.js → chunk-egeb4821.js} +2 -2
- package/dist/{chunk-d4ctj079.js → chunk-q5v72erd.js} +2 -2
- package/dist/{chunk-04r0t2mb.js → chunk-wvbz0nmd.js} +97 -49
- package/dist/{chunk-r5s2v669.js → chunk-y8fnwbx0.js} +512 -480
- package/dist/dashboard-source/apps/frontend/app/(protected)/connected-apps/disconnect-form.tsx +57 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/connected-apps/page.tsx +97 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/[...listPath]/list-page-client.tsx +26 -1
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/[...listPath]/page.tsx +11 -12
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/components/list-create-form.tsx +7 -5
- package/dist/dashboard-source/apps/frontend/app/api/dev/import-events/route.ts +69 -1
- package/dist/dashboard-source/apps/frontend/app/app-shell.tsx +4 -3
- package/dist/dashboard-source/apps/frontend/app/mcp/[[...endpoint]]/route.ts +0 -3
- package/dist/dashboard-source/apps/frontend/components/Header.tsx +10 -0
- package/dist/dashboard-source/apps/frontend/lib/collections/collection-provider-factory.tsx +3 -2
- package/dist/dashboard-source/apps/frontend/lib/collections/graphql-stream.ts +21 -1
- package/dist/dashboard-source/apps/frontend/lib/dev/import-completed-query-invalidation.tsx +66 -9
- package/dist/dashboard-source/apps/frontend/lib/dev/import-completed-refresh.ts +10 -6
- package/dist/dashboard-source/apps/frontend/lib/generated/gql/gql.ts +3 -3
- package/dist/dashboard-source/apps/frontend/lib/generated/gql/graphql.ts +2 -3
- package/dist/dashboard-source/apps/frontend/lib/mcp/oauth.ts +61 -72
- package/dist/dashboard-source/apps/frontend/lib/mcp/origin.ts +20 -12
- package/dist/dashboard-source/apps/frontend/lib/mcp/store.ts +80 -166
- package/dist/dashboard-source/apps/frontend/lib/mcp/todos.ts +42 -19
- package/dist/dashboard-source/apps/frontend/package.json +2 -3
- package/dist/dashboard-source/modules/shadcn-components/src/lib/date-time-display.tsx +3 -2
- package/dist/dashboard-source.json +2 -3
- package/dist/graphql-server.mjs +34 -7
- package/dist/job-worker-supervisor.mjs +3 -3
- package/dist/job-worker.mjs +5 -5
- package/dist/main.mjs +7 -2
- package/dist/resources/graphql-schema/system.graphql +1 -0
- package/package.json +3 -4
|
@@ -6,8 +6,8 @@ import { graphql } from "@/lib/generated/gql"
|
|
|
6
6
|
import { toUrlPath } from "@/lib/utils"
|
|
7
7
|
|
|
8
8
|
const todos = graphql(`
|
|
9
|
-
query McpActionableTodos($page: Int
|
|
10
|
-
todos(page: $page, limit: 25, status:
|
|
9
|
+
query McpActionableTodos($page: Int!) {
|
|
10
|
+
todos(page: $page, limit: 25, status: "Actionable") {
|
|
11
11
|
page
|
|
12
12
|
hasNextPage
|
|
13
13
|
nodes {
|
|
@@ -15,6 +15,7 @@ const todos = graphql(`
|
|
|
15
15
|
processExecutionId
|
|
16
16
|
processName
|
|
17
17
|
stepName
|
|
18
|
+
stepPath
|
|
18
19
|
status
|
|
19
20
|
priority
|
|
20
21
|
dueAt
|
|
@@ -31,21 +32,49 @@ const ToolArguments = Schema.Struct({
|
|
|
31
32
|
Schema.check(Schema.isBetween({ minimum: 1, maximum: 2147483647 })),
|
|
32
33
|
),
|
|
33
34
|
),
|
|
34
|
-
status: Schema.optionalKey(
|
|
35
|
-
Schema.Literals(["Active", "Correction Required"]),
|
|
36
|
-
),
|
|
37
35
|
})
|
|
38
36
|
|
|
37
|
+
const todoDashboardUrl = (
|
|
38
|
+
origin: string,
|
|
39
|
+
route: "complete" | "correct",
|
|
40
|
+
stepPath: string,
|
|
41
|
+
todoId: string,
|
|
42
|
+
): string => {
|
|
43
|
+
const path = toUrlPath(stepPath).split("/").map(encodeURIComponent).join("/")
|
|
44
|
+
const url = new URL(`/to-dos/${route}/${path}`, origin)
|
|
45
|
+
url.searchParams.set("todoId", todoId)
|
|
46
|
+
return url.href
|
|
47
|
+
}
|
|
48
|
+
|
|
39
49
|
export const listMyTodos = defineReadTool({
|
|
40
50
|
name: "list_my_todos",
|
|
41
51
|
description:
|
|
42
|
-
"List
|
|
52
|
+
"List or count the signed-in person's actionable To-Dos. Start at page 1 and continue while hasNextPage is true. Give one count or list without a separate correction category or a zero-corrections note. Explain requiredAction only when discussing that specific To-Do. If asked to act on a To-Do with requiredAction, give its dashboardUrl instead of inspecting or submitting a normal form.",
|
|
43
53
|
args: ToolArguments,
|
|
44
54
|
failure: "The runtime did not authorize or return the To-Dos.",
|
|
45
|
-
read: ({ client }, { page
|
|
46
|
-
Effect.
|
|
47
|
-
|
|
48
|
-
|
|
55
|
+
read: ({ client, origin }, { page }) =>
|
|
56
|
+
Effect.gen(function* () {
|
|
57
|
+
const { todos: result } = yield* Effect.tryPromise(() =>
|
|
58
|
+
client.request(todos, { page: page ?? 1 }),
|
|
59
|
+
)
|
|
60
|
+
return {
|
|
61
|
+
...result,
|
|
62
|
+
nodes: result.nodes.map(({ stepPath, ...todo }) =>
|
|
63
|
+
todo.status === "Correction Required"
|
|
64
|
+
? {
|
|
65
|
+
...todo,
|
|
66
|
+
requiredAction: "Fix the recipient email for the invitation.",
|
|
67
|
+
dashboardUrl: todoDashboardUrl(
|
|
68
|
+
origin,
|
|
69
|
+
"correct",
|
|
70
|
+
stepPath,
|
|
71
|
+
todo.id,
|
|
72
|
+
),
|
|
73
|
+
}
|
|
74
|
+
: todo,
|
|
75
|
+
),
|
|
76
|
+
}
|
|
77
|
+
}),
|
|
49
78
|
})
|
|
50
79
|
|
|
51
80
|
const todoForm = graphql(`
|
|
@@ -90,15 +119,9 @@ const readForm = (
|
|
|
90
119
|
const form = yield* Schema.decodeUnknownEffect(RuntimeForm)(
|
|
91
120
|
response.todoChatForm,
|
|
92
121
|
)
|
|
93
|
-
const path = toUrlPath(form.stepPath)
|
|
94
|
-
.split("/")
|
|
95
|
-
.map(encodeURIComponent)
|
|
96
|
-
.join("/")
|
|
97
|
-
const url = new URL(`/to-dos/complete/${path}`, origin)
|
|
98
|
-
url.searchParams.set("todoId", todoId)
|
|
99
122
|
return {
|
|
100
123
|
...form,
|
|
101
|
-
dashboardUrl:
|
|
124
|
+
dashboardUrl: todoDashboardUrl(origin, "complete", form.stepPath, todoId),
|
|
102
125
|
validationBasis:
|
|
103
126
|
"Only the supplied answers and authored defaults were checked. If any answer was not passed to this call or has changed, inspect again with all known answers before deciding what is missing.",
|
|
104
127
|
}
|
|
@@ -107,7 +130,7 @@ const readForm = (
|
|
|
107
130
|
export const inspectTodoForm = defineReadTool({
|
|
108
131
|
name: "inspect_todo_form",
|
|
109
132
|
description:
|
|
110
|
-
"Read and validate the exact To-Do's form without submitting. The result reflects only the answers passed to this call plus authored defaults. After mapping the person's answers to field names, call again with all known answers before deciding the form is complete: an answer can reveal new required fields. Use the authored labels and choices. Ask for missing or invalid business answers; do not guess. If needsDashboard is true, give the exact dashboardUrl and say the To-Do remains open.",
|
|
133
|
+
"Read and validate the exact To-Do's form without submitting. Identify the To-Do with list_my_todos first; if it has requiredAction, give its dashboardUrl instead. The result reflects only the answers passed to this call plus authored defaults. After mapping the person's answers to field names, call again with all known answers before deciding the form is complete: an answer can reveal new required fields. Use the authored labels and choices. Ask for missing or invalid business answers; do not guess. If needsDashboard is true, give the exact dashboardUrl and say the To-Do remains open.",
|
|
111
134
|
args: Schema.Struct(formArgs),
|
|
112
135
|
failure: "The runtime did not authorize or return this open To-Do form.",
|
|
113
136
|
read: (context, { todoId, answers }) =>
|
|
@@ -136,7 +159,7 @@ const result = (
|
|
|
136
159
|
const completeMetadata = {
|
|
137
160
|
name: "complete_todo",
|
|
138
161
|
description:
|
|
139
|
-
"Complete one exact To-Do only after the person explicitly asks you to submit it. Inspect the form with the proposed answers first. Ask for missing business answers and hand off unsupported required fields to the Dashboard. If the response is lost, retry only with the same To-Do and unchanged answers as the same caller.",
|
|
162
|
+
"Complete one exact To-Do only after the person explicitly asks you to submit it. For a To-Do with requiredAction from list_my_todos, give its dashboardUrl instead. Inspect the form with the proposed answers first. Ask for missing business answers and hand off unsupported required fields to the Dashboard. If the response is lost, retry only with the same To-Do and unchanged answers as the same caller.",
|
|
140
163
|
inputSchema: {
|
|
141
164
|
type: "object",
|
|
142
165
|
properties: {
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"private": true,
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.1.0-next.
|
|
4
|
+
"version": "0.1.0-next.4",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@aws-sdk/client-acm": "^3.1169.0",
|
|
7
7
|
"@aws-sdk/client-ssm": "^3.1169.0",
|
|
8
8
|
"@cedar-policy/cedar-wasm": "^4.14.0",
|
|
9
9
|
"@date-fns/utc": "^2.1.1",
|
|
10
|
-
"@effect-aws/client-dynamodb": "2.0.0",
|
|
11
10
|
"@effect/opentelemetry": "4.1.4",
|
|
12
11
|
"@effect/platform-node": "4.1.4",
|
|
13
12
|
"@graphql-typed-document-node/core": "^3.2.0",
|
|
@@ -21,7 +20,7 @@
|
|
|
21
20
|
"@opentelemetry/resources": "^2.12.1",
|
|
22
21
|
"@opentelemetry/sdk-metrics": "^2.12.1",
|
|
23
22
|
"@opentelemetry/sdk-trace-base": "^2.12.1",
|
|
24
|
-
"@processfocus/runtime": "0.1.0-next.
|
|
23
|
+
"@processfocus/runtime": "0.1.0-next.4",
|
|
25
24
|
"@radix-ui/react-checkbox": "^1.4.1",
|
|
26
25
|
"@radix-ui/react-dialog": "^1.3.1",
|
|
27
26
|
"@radix-ui/react-dropdown-menu": "^2.2.1",
|
|
@@ -22,7 +22,7 @@ export type DateTimeDisplayProps = { className?: string } & (
|
|
|
22
22
|
value: string | Date | number
|
|
23
23
|
initialMode?: DateTimeDisplayMode
|
|
24
24
|
eventTimeZone?: string
|
|
25
|
-
seconds?: boolean
|
|
25
|
+
seconds?: boolean | "milliseconds"
|
|
26
26
|
}
|
|
27
27
|
)
|
|
28
28
|
|
|
@@ -117,7 +117,7 @@ function absolute(
|
|
|
117
117
|
date: Date,
|
|
118
118
|
locale: string,
|
|
119
119
|
timeZone: string,
|
|
120
|
-
seconds: boolean,
|
|
120
|
+
seconds: boolean | "milliseconds",
|
|
121
121
|
calendar = false,
|
|
122
122
|
) {
|
|
123
123
|
return new Intl.DateTimeFormat(locale, {
|
|
@@ -131,6 +131,7 @@ function absolute(
|
|
|
131
131
|
hour: "numeric",
|
|
132
132
|
minute: "2-digit",
|
|
133
133
|
...(seconds ? { second: "2-digit" } : {}),
|
|
134
|
+
...(seconds === "milliseconds" ? { fractionalSecondDigits: 3 } : {}),
|
|
134
135
|
timeZoneName: "short",
|
|
135
136
|
} satisfies Intl.DateTimeFormatOptions)),
|
|
136
137
|
}).format(date)
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"format": 1,
|
|
3
|
-
"sha256": "
|
|
3
|
+
"sha256": "16441d53d7e378c8c51749e48cde58bc5faf9bae25d25757bb807f888dddac03",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"@aws-sdk/client-acm": "^3.1169.0",
|
|
6
6
|
"@aws-sdk/client-ssm": "^3.1169.0",
|
|
7
7
|
"@cedar-policy/cedar-wasm": "^4.14.0",
|
|
8
8
|
"@date-fns/utc": "^2.1.1",
|
|
9
|
-
"@effect-aws/client-dynamodb": "2.0.0",
|
|
10
9
|
"@effect/opentelemetry": "4.1.4",
|
|
11
10
|
"@effect/platform-node": "4.1.4",
|
|
12
11
|
"@graphql-typed-document-node/core": "^3.2.0",
|
|
@@ -20,7 +19,7 @@
|
|
|
20
19
|
"@opentelemetry/resources": "^2.12.1",
|
|
21
20
|
"@opentelemetry/sdk-metrics": "^2.12.1",
|
|
22
21
|
"@opentelemetry/sdk-trace-base": "^2.12.1",
|
|
23
|
-
"@processfocus/runtime": "0.1.0-next.
|
|
22
|
+
"@processfocus/runtime": "0.1.0-next.4",
|
|
24
23
|
"@radix-ui/react-checkbox": "^1.4.1",
|
|
25
24
|
"@radix-ui/react-dialog": "^1.3.1",
|
|
26
25
|
"@radix-ui/react-dropdown-menu": "^2.2.1",
|
package/dist/graphql-server.mjs
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
layer,
|
|
4
|
+
normalizePath,
|
|
4
5
|
OrganisationProvider,
|
|
6
|
+
OrganisationProviderFromPath,
|
|
5
7
|
OrganisationProviderFromPathDev,
|
|
6
8
|
CedarPoliciesProvider,
|
|
7
9
|
OrgCedarPoliciesProvider,
|
|
@@ -44,6 +46,7 @@ import {
|
|
|
44
46
|
Yoga,
|
|
45
47
|
ResolverRuntime,
|
|
46
48
|
YogaLive,
|
|
49
|
+
makeMcpOAuthStorageRoute,
|
|
47
50
|
warnIgnoredCronDeclarations,
|
|
48
51
|
getEffectiveFrontendBaseUrl,
|
|
49
52
|
LocalDocumentStoreConfig,
|
|
@@ -54,7 +57,7 @@ import {
|
|
|
54
57
|
ProjectAccountingChange,
|
|
55
58
|
ProjectAccountingEvents,
|
|
56
59
|
LocalQueueServiceLive
|
|
57
|
-
} from "./chunk-
|
|
60
|
+
} from "./chunk-y8fnwbx0.js";
|
|
58
61
|
import {
|
|
59
62
|
hasInvalidDownloadFilename,
|
|
60
63
|
formatContentDisposition,
|
|
@@ -70,29 +73,32 @@ import {
|
|
|
70
73
|
SqliteDelegationDatabaseLive,
|
|
71
74
|
SqliteAuthenticationDatabaseLive,
|
|
72
75
|
makeLocalSqlClientLayer
|
|
73
|
-
} from "./chunk-
|
|
76
|
+
} from "./chunk-wvbz0nmd.js";
|
|
74
77
|
import {
|
|
75
78
|
NumberFromString,
|
|
76
79
|
DEFAULT_GRAPHQL_PORT,
|
|
77
80
|
GRAPHQL_PORT_FILE
|
|
78
|
-
} from "./chunk-
|
|
81
|
+
} from "./chunk-5kjvzbwr.js";
|
|
79
82
|
import {
|
|
80
83
|
RequestTime,
|
|
81
84
|
SqliteCompletedJobOperationsLive,
|
|
82
85
|
SqliteFileOperationsLive,
|
|
83
86
|
SqliteFlowExecutionOperationsLive,
|
|
84
87
|
SqliteGraphqlDbOperationsLive,
|
|
88
|
+
SqliteMcpOAuthRecordsLive,
|
|
85
89
|
SqliteScheduledFlowOperationsLive
|
|
86
|
-
} from "./chunk-
|
|
90
|
+
} from "./chunk-3wzp2sax.js";
|
|
87
91
|
import {
|
|
88
92
|
serveOnExactPort,
|
|
89
93
|
serveWithPortFallback,
|
|
90
94
|
writePortFile,
|
|
91
95
|
LocalRuntimeAuditLive,
|
|
92
96
|
LocalPolicyRevisionPublisherLive
|
|
93
|
-
} from "./chunk-
|
|
97
|
+
} from "./chunk-egeb4821.js";
|
|
94
98
|
|
|
95
99
|
// src/graphql-server/graphql-server.ts
|
|
100
|
+
import { randomUUID } from "crypto";
|
|
101
|
+
import { join as join2, resolve } from "path";
|
|
96
102
|
import * as NodeSdk from "@effect/opentelemetry/NodeSdk";
|
|
97
103
|
import { OTLPMetricExporter } from "@opentelemetry/exporter-metrics-otlp-http";
|
|
98
104
|
import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-http";
|
|
@@ -105,6 +111,7 @@ import {
|
|
|
105
111
|
DateTime,
|
|
106
112
|
Effect as Effect5,
|
|
107
113
|
Exit as Exit2,
|
|
114
|
+
FileSystem,
|
|
108
115
|
Layer as Layer5,
|
|
109
116
|
Logger,
|
|
110
117
|
ManagedRuntime,
|
|
@@ -737,6 +744,7 @@ var makeServerEffect = (port) => Effect4.gen(function* () {
|
|
|
737
744
|
const resolverRuntime = yield* ResolverRuntime;
|
|
738
745
|
const routeServerPluginWebhook = yield* makeServerPluginWebhookRouter;
|
|
739
746
|
const callbackSecret = yield* CallbackSecret;
|
|
747
|
+
const routeMcpOAuthStorage = yield* makeMcpOAuthStorageRoute(process.env["PF_MCP_STORAGE_SECRET"]);
|
|
740
748
|
const docStoreConfig = yield* LocalDocumentStoreConfig;
|
|
741
749
|
const dbConnectionInfo = yield* DatabaseConnectionInfo;
|
|
742
750
|
yield* Effect4.log(`\uD83D\uDCBE Connecting to database: ${dbConnectionInfo}`);
|
|
@@ -837,6 +845,9 @@ var makeServerEffect = (port) => Effect4.gen(function* () {
|
|
|
837
845
|
const serverOptions = {
|
|
838
846
|
fetch: async (request, srv) => {
|
|
839
847
|
const url = new URL(request.url);
|
|
848
|
+
const mcpOAuthEffect = routeMcpOAuthStorage(request);
|
|
849
|
+
if (mcpOAuthEffect !== undefined)
|
|
850
|
+
return resolverRuntime.runPromise(mcpOAuthEffect);
|
|
840
851
|
const webhookEffect = routeServerPluginWebhook(request);
|
|
841
852
|
if (webhookEffect !== undefined) {
|
|
842
853
|
return resolverRuntime.runPromise(webhookEffect);
|
|
@@ -1291,7 +1302,14 @@ var NodeSdkLive = Layer5.unwrap(Effect5.gen(function* () {
|
|
|
1291
1302
|
}));
|
|
1292
1303
|
var main = Effect5.gen(function* () {
|
|
1293
1304
|
const cliConfig = yield* CliConfig;
|
|
1294
|
-
const
|
|
1305
|
+
const importDir = process.env["PF_LOCAL_GRAPHQL_IMPORT"] === "1" ? resolve(cliConfig.org, ".processfocus/local-graphql") : undefined;
|
|
1306
|
+
const OrgProviderLayer = (importDir ? Layer5.effect(OrganisationProvider, Effect5.gen(function* () {
|
|
1307
|
+
const slot = (yield* Effect5.promise(() => import(join2(importDir, "active.json")))).default;
|
|
1308
|
+
if (slot !== "a" && slot !== "b")
|
|
1309
|
+
return yield* Effect5.fail(new Error("Invalid local GraphQL import slot"));
|
|
1310
|
+
const loaded = yield* OrganisationProvider.pipe(Effect5.provide(OrganisationProviderFromPath(join2(importDir, slot))));
|
|
1311
|
+
return { ...loaded, orgPath: resolve(cliConfig.org) };
|
|
1312
|
+
})) : OrganisationProviderFromPathDev(cliConfig.org)).pipe(Layer5.provide(layer));
|
|
1295
1313
|
const CedarPoliciesLayer = OrgCedarPoliciesProvider.pipe(Layer5.provide(OrgProviderLayer));
|
|
1296
1314
|
const orgProvider = yield* OrganisationProvider.pipe(Effect5.provide(OrgProviderLayer));
|
|
1297
1315
|
yield* warnIgnoredCronDeclarations(orgProvider.organisation, "local GraphQL runtime");
|
|
@@ -1324,7 +1342,7 @@ var main = Effect5.gen(function* () {
|
|
|
1324
1342
|
const customDbLayerWithDeps = orgProvider.customDbLayer ? Layer5.provide(orgProvider.customDbLayer, customDbLayerDeps) : undefined;
|
|
1325
1343
|
const HttpCedarReloadNotifierWithDeps = HttpCedarReloadNotifierLive.pipe(Layer5.provide(FetchHttpClient.layer));
|
|
1326
1344
|
const SqliteQueueWithRequestContext = LocalQueueServiceLive.pipe(Layer5.provide(Layer5.merge(RequestTimeLive, UserDetailsLive)));
|
|
1327
|
-
const AppLayer = Layer5.mergeAll(LocalRuntimeAuditLive, AuthenticationDelegationIdentityFactsLive.pipe(Layer5.provideMerge(SqliteAuthenticationDatabaseLive)), DelegationSessionServiceIsolated.pipe(Layer5.provide(Layer5.mergeAll(AuthenticationDelegationIdentityFactsLive.pipe(Layer5.provide(SqliteAuthenticationDatabaseLive)), SqliteDelegationDatabaseLive)), Layer5.provide(AuthorizationLive)), SqliteGraphqlDbOperationsLive, SqliteFileOperationsLive, SqliteFlowExecutionOperationsLive, SqliteCompletedJobOperationsLive, SqliteScheduledFlowOperationsLive, SqliteQueueWithRequestContext, DynamicSchemaConfigLive, Layer5.provide(LocalDocumentStoreServiceLive, LocalDocumentStoreConfigLive), LocalDocumentStoreConfigLive, ListExportServiceWithDeps, DraftProcessEventsLive, TodoEventsLive, ProcessEventsLive, ProjectAccountingEventsLive.pipe(Layer5.provide(SqliteQueueWithRequestContext)), ExecutionEventsLive, RequestTimeLive, UserDetailsLive, CurrentPrincipalLive, BusinessMetricDimensionsLive, DashboardActivityLive, AuthorizationLive, TodoSummaryComputationWithDeps, SlaCalculationServiceWithDeps, HttpCedarReloadNotifierWithDeps, Layer5.provide(DraftProcessExecutionCollectionOpsLive, SqliteGraphqlDbOperationsLive), Layer5.provide(ProcessCollectionOpsLive, SqliteGraphqlDbOperationsLive), Layer5.provide(ProcessDurationServiceLive, SqliteGraphqlDbOperationsLive), Layer5.provide(TodoCollectionOpsLive, SqliteGraphqlDbOperationsLive), ExecutionCollectionOpsWithDeps, ...customDbLayerWithDeps ? [customDbLayerWithDeps] : []).pipe(Layer5.provideMerge(OrgProviderLayer), Layer5.provideMerge(TypedSqliteDrizzleLayer), Layer5.provideMerge(LocalSqlClientLive), Layer5.provideMerge(FetchHttpClient.layer));
|
|
1345
|
+
const AppLayer = Layer5.mergeAll(LocalRuntimeAuditLive, AuthenticationDelegationIdentityFactsLive.pipe(Layer5.provideMerge(SqliteAuthenticationDatabaseLive)), DelegationSessionServiceIsolated.pipe(Layer5.provide(Layer5.mergeAll(AuthenticationDelegationIdentityFactsLive.pipe(Layer5.provide(SqliteAuthenticationDatabaseLive)), SqliteDelegationDatabaseLive)), Layer5.provide(AuthorizationLive)), SqliteGraphqlDbOperationsLive, SqliteMcpOAuthRecordsLive, SqliteFileOperationsLive, SqliteFlowExecutionOperationsLive, SqliteCompletedJobOperationsLive, SqliteScheduledFlowOperationsLive, SqliteQueueWithRequestContext, DynamicSchemaConfigLive, Layer5.provide(LocalDocumentStoreServiceLive, LocalDocumentStoreConfigLive), LocalDocumentStoreConfigLive, ListExportServiceWithDeps, DraftProcessEventsLive, TodoEventsLive, ProcessEventsLive, ProjectAccountingEventsLive.pipe(Layer5.provide(SqliteQueueWithRequestContext)), ExecutionEventsLive, RequestTimeLive, UserDetailsLive, CurrentPrincipalLive, BusinessMetricDimensionsLive, DashboardActivityLive, AuthorizationLive, TodoSummaryComputationWithDeps, SlaCalculationServiceWithDeps, HttpCedarReloadNotifierWithDeps, Layer5.provide(DraftProcessExecutionCollectionOpsLive, SqliteGraphqlDbOperationsLive), Layer5.provide(ProcessCollectionOpsLive, SqliteGraphqlDbOperationsLive), Layer5.provide(ProcessDurationServiceLive, SqliteGraphqlDbOperationsLive), Layer5.provide(TodoCollectionOpsLive, SqliteGraphqlDbOperationsLive), ExecutionCollectionOpsWithDeps, ...customDbLayerWithDeps ? [customDbLayerWithDeps] : []).pipe(Layer5.provideMerge(OrgProviderLayer), Layer5.provideMerge(TypedSqliteDrizzleLayer), Layer5.provideMerge(LocalSqlClientLive), Layer5.provideMerge(FetchHttpClient.layer));
|
|
1328
1346
|
const ServerLive = Layer5.effectDiscard(Effect5.gen(function* () {
|
|
1329
1347
|
const authConfig = yield* AuthConfig;
|
|
1330
1348
|
yield* Effect5.log(`\uD83D\uDD10 Authentication server: ${authConfig.issuerUrl}`);
|
|
@@ -1333,6 +1351,15 @@ var main = Effect5.gen(function* () {
|
|
|
1333
1351
|
if (Option4.isNone(cliConfig.port)) {
|
|
1334
1352
|
yield* writePortFile(GRAPHQL_PORT_FILE, server.port);
|
|
1335
1353
|
}
|
|
1354
|
+
if (importDir) {
|
|
1355
|
+
const fs = yield* FileSystem.FileSystem.pipe(Effect5.provide(layer));
|
|
1356
|
+
const ready = join2(importDir, "ready.json");
|
|
1357
|
+
yield* fs.writeFileString(`${ready}.tmp`, JSON.stringify({
|
|
1358
|
+
revision: randomUUID(),
|
|
1359
|
+
processPaths: orgProvider.organisation.processes().map((p) => normalizePath(p.node.path))
|
|
1360
|
+
}));
|
|
1361
|
+
yield* fs.rename(`${ready}.tmp`, ready);
|
|
1362
|
+
}
|
|
1336
1363
|
return yield* Effect5.never;
|
|
1337
1364
|
}));
|
|
1338
1365
|
const QueueCapabilityLive = SqliteQueueWithRequestContext.pipe(Layer5.provide(AppLayer));
|
|
@@ -4,17 +4,17 @@ import {
|
|
|
4
4
|
TypedSqliteDrizzleLayer,
|
|
5
5
|
UserDetails,
|
|
6
6
|
makeLocalSqlClientLayer
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-wvbz0nmd.js";
|
|
8
8
|
import {
|
|
9
9
|
RequestTime,
|
|
10
10
|
SqliteQueueServiceLive
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-3wzp2sax.js";
|
|
12
12
|
import {
|
|
13
13
|
readAttemptPolicy,
|
|
14
14
|
readQueueObservationPolicy,
|
|
15
15
|
observeQueueHealth,
|
|
16
16
|
WorkerMessage
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-q5v72erd.js";
|
|
18
18
|
|
|
19
19
|
// src/job-worker/job-worker-supervisor.ts
|
|
20
20
|
import { resolve } from "path";
|
package/dist/job-worker.mjs
CHANGED
|
@@ -45,7 +45,7 @@ import {
|
|
|
45
45
|
LoggingEmailSenderLive,
|
|
46
46
|
buildTodoChangeEvent,
|
|
47
47
|
LocalQueueServiceLive
|
|
48
|
-
} from "./chunk-
|
|
48
|
+
} from "./chunk-y8fnwbx0.js";
|
|
49
49
|
import {
|
|
50
50
|
ExecutorError,
|
|
51
51
|
ExecutorHost,
|
|
@@ -79,12 +79,12 @@ import {
|
|
|
79
79
|
NOTIFICATION_DELIVERY_QUEUE,
|
|
80
80
|
UserDetails,
|
|
81
81
|
makeLocalSqlClientLayer
|
|
82
|
-
} from "./chunk-
|
|
82
|
+
} from "./chunk-wvbz0nmd.js";
|
|
83
83
|
import {
|
|
84
84
|
DEFAULT_GRAPHQL_PORT,
|
|
85
85
|
GRAPHQL_PORT_FILE,
|
|
86
86
|
decodePortFromFileContent
|
|
87
|
-
} from "./chunk-
|
|
87
|
+
} from "./chunk-5kjvzbwr.js";
|
|
88
88
|
import {
|
|
89
89
|
RequestTime,
|
|
90
90
|
SqliteCompletedJobOperationsLive,
|
|
@@ -93,7 +93,7 @@ import {
|
|
|
93
93
|
SqliteGraphqlDbOperationsLive,
|
|
94
94
|
SqliteScheduledFlowOperationsLive,
|
|
95
95
|
SqliteQueueMaintenance
|
|
96
|
-
} from "./chunk-
|
|
96
|
+
} from "./chunk-3wzp2sax.js";
|
|
97
97
|
import {
|
|
98
98
|
AttemptEscalation,
|
|
99
99
|
readAttemptPolicy,
|
|
@@ -103,7 +103,7 @@ import {
|
|
|
103
103
|
observeQueueHealth,
|
|
104
104
|
reportWorkerActivity,
|
|
105
105
|
startWorkerHeartbeat
|
|
106
|
-
} from "./chunk-
|
|
106
|
+
} from "./chunk-q5v72erd.js";
|
|
107
107
|
|
|
108
108
|
// src/job-worker/job-worker.ts
|
|
109
109
|
import { existsSync as existsSync4 } from "fs";
|
package/dist/main.mjs
CHANGED
|
@@ -295,6 +295,7 @@ var startLocalRuntime = async (options) => {
|
|
|
295
295
|
let graphqlUrl = `http://localhost:${graphqlPort}/graphql`;
|
|
296
296
|
const dashboardUrl = `http://localhost:${dashboardPort}`;
|
|
297
297
|
const cli = resolveCli();
|
|
298
|
+
const mcpStorageSecret = randomBytes(32).toString("hex");
|
|
298
299
|
const env = {
|
|
299
300
|
...process.env,
|
|
300
301
|
NODE_ENV: process.env["NODE_ENV"] ?? "development",
|
|
@@ -374,7 +375,8 @@ var startLocalRuntime = async (options) => {
|
|
|
374
375
|
...options.graphqlPort === undefined ? [] : ["--port", String(graphqlPort)],
|
|
375
376
|
"--org",
|
|
376
377
|
orgPath
|
|
377
|
-
]
|
|
378
|
+
],
|
|
379
|
+
childEnv: { ...env, PF_MCP_STORAGE_SECRET: mcpStorageSecret }
|
|
378
380
|
});
|
|
379
381
|
graphqlUrl = `http://localhost:${options.graphqlPort ?? await waitForPort(".graphql-port.json", graphql)}/graphql`;
|
|
380
382
|
env["GRAPHQL_ENDPOINT"] = graphqlUrl;
|
|
@@ -445,7 +447,10 @@ var startLocalRuntime = async (options) => {
|
|
|
445
447
|
"127.0.0.1"
|
|
446
448
|
],
|
|
447
449
|
cwd: dashboardDirectory(runtimeRoot),
|
|
448
|
-
childEnv:
|
|
450
|
+
childEnv: {
|
|
451
|
+
...dashboardEnvironment(env),
|
|
452
|
+
PF_MCP_STORAGE_SECRET: mcpStorageSecret
|
|
453
|
+
},
|
|
449
454
|
executable: "node"
|
|
450
455
|
});
|
|
451
456
|
await waitForHttp(`${dashboardUrl}/_pf/health`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@processfocus/runtime-local",
|
|
3
|
-
"version": "0.1.0-next.
|
|
3
|
+
"version": "0.1.0-next.4",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -25,7 +25,6 @@
|
|
|
25
25
|
"@aws-sdk/client-ssm": "^3.1169.0",
|
|
26
26
|
"@cedar-policy/cedar-wasm": "^4.14.0",
|
|
27
27
|
"@date-fns/utc": "^2.1.1",
|
|
28
|
-
"@effect-aws/client-dynamodb": "2.0.0",
|
|
29
28
|
"@effect/opentelemetry": "4.1.4",
|
|
30
29
|
"@effect/platform-node": "4.1.4",
|
|
31
30
|
"@graphql-typed-document-node/core": "^3.2.0",
|
|
@@ -40,8 +39,8 @@
|
|
|
40
39
|
"@opentelemetry/sdk-metrics": "^2.12.1",
|
|
41
40
|
"@opentelemetry/sdk-trace-base": "^2.12.1",
|
|
42
41
|
"@opentelemetry/sdk-trace-node": "^2.12.1",
|
|
43
|
-
"@processfocus/cli": "0.1.0-next.
|
|
44
|
-
"@processfocus/runtime": "0.1.0-next.
|
|
42
|
+
"@processfocus/cli": "0.1.0-next.4",
|
|
43
|
+
"@processfocus/runtime": "0.1.0-next.4",
|
|
45
44
|
"@radix-ui/react-checkbox": "^1.4.1",
|
|
46
45
|
"@radix-ui/react-dialog": "^1.3.1",
|
|
47
46
|
"@radix-ui/react-dropdown-menu": "^2.2.1",
|