@moorline/core 0.0.2 → 0.0.3
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/core/domain/sessions/runtimeWorkManagementService.d.ts +26 -0
- package/dist/core/domain/sessions/runtimeWorkManagementService.js +140 -78
- package/dist/core/domain/sessions/runtimeWorkManagementService.js.map +1 -1
- package/dist/core/domain/sessions/sessionState.d.ts +4 -0
- package/dist/core/domain/sessions/sessionState.js +38 -2
- package/dist/core/domain/sessions/sessionState.js.map +1 -1
- package/dist/core/extension/capabilities/capabilities.d.ts +1 -1
- package/dist/core/extension/capabilities/capabilities.js +3 -0
- package/dist/core/extension/capabilities/capabilities.js.map +1 -1
- package/dist/core/extension/packages/npmRegistryClient.js +3 -15
- package/dist/core/extension/packages/npmRegistryClient.js.map +1 -1
- package/dist/core/extension/plugins/pluginHost.d.ts +7 -7
- package/dist/core/extension/plugins/pluginHost.js +11 -9
- package/dist/core/extension/plugins/pluginHost.js.map +1 -1
- package/dist/core/runtime/execution/runtimeInteractionService.d.ts +8 -8
- package/dist/core/runtime/execution/runtimeInteractionService.js +14 -26
- package/dist/core/runtime/execution/runtimeInteractionService.js.map +1 -1
- package/dist/core/runtime/execution/runtimePluginContextService.js +7 -1
- package/dist/core/runtime/execution/runtimePluginContextService.js.map +1 -1
- package/dist/core/runtime/hosting/runtimeHostingService.d.ts +5 -3
- package/dist/core/runtime/hosting/runtimeHostingService.js +12 -31
- package/dist/core/runtime/hosting/runtimeHostingService.js.map +1 -1
- package/dist/core/runtime/hosting/runtimeTransportEffectService.d.ts +22 -0
- package/dist/core/runtime/hosting/runtimeTransportEffectService.js +86 -0
- package/dist/core/runtime/hosting/runtimeTransportEffectService.js.map +1 -0
- package/dist/core/runtime/hosting/runtimeTransportIntentService.d.ts +23 -0
- package/dist/core/runtime/hosting/runtimeTransportIntentService.js +144 -0
- package/dist/core/runtime/hosting/runtimeTransportIntentService.js.map +1 -0
- package/dist/core/runtime/hosting/runtimeTransportSurfaceService.d.ts +2 -3
- package/dist/core/runtime/hosting/runtimeTransportSurfaceService.js +8 -56
- package/dist/core/runtime/hosting/runtimeTransportSurfaceService.js.map +1 -1
- package/dist/core/runtime/lifecycle/runtimeLifecycleService.js +0 -13
- package/dist/core/runtime/lifecycle/runtimeLifecycleService.js.map +1 -1
- package/dist/core/runtime/moorlineRuntime.d.ts +1 -1
- package/dist/core/runtime/moorlineRuntime.js +6 -14
- package/dist/core/runtime/moorlineRuntime.js.map +1 -1
- package/dist/core/runtime/moorlineRuntimeBuilder.d.ts +4 -2
- package/dist/core/runtime/moorlineRuntimeBuilder.js +22 -22
- package/dist/core/runtime/moorlineRuntimeBuilder.js.map +1 -1
- package/dist/core/system/state/sqlite/transportIntentRepository.d.ts +12 -0
- package/dist/core/system/state/sqlite/transportIntentRepository.js +106 -0
- package/dist/core/system/state/sqlite/transportIntentRepository.js.map +1 -0
- package/dist/core/system/state/sqliteSessionStore.d.ts +6 -0
- package/dist/core/system/state/sqliteSessionStore.js +15 -0
- package/dist/core/system/state/sqliteSessionStore.js.map +1 -1
- package/dist/types/config.d.ts +4 -11
- package/dist/types/config.js.map +1 -1
- package/dist/types/transport.d.ts +1 -1
- package/dist/types/transport.js.map +1 -1
- package/package.json +6 -3
- package/resources/migrations/018_transport_intents.sql +18 -0
- package/dist/core/runtime/lifecycle/managedTransportResourceLifecycleService.d.ts +0 -34
- package/dist/core/runtime/lifecycle/managedTransportResourceLifecycleService.js +0 -158
- package/dist/core/runtime/lifecycle/managedTransportResourceLifecycleService.js.map +0 -1
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { AppliedMoorlineConfig, RuntimeSurfaceState } from '../../../types/config.js';
|
|
2
2
|
import type { RuntimeEnvironmentVerifier } from '../../../types/provider.js';
|
|
3
3
|
import type { RuntimeManagementSurfaceHandle } from './runtimeManagementPort.js';
|
|
4
|
-
import type { RuntimeActionDefinition, RuntimeTransport,
|
|
4
|
+
import type { RuntimeActionDefinition, RuntimeTransport, RuntimeTransportIntent } from '../../../types/transport.js';
|
|
5
|
+
import type { RuntimeTransportEffectService } from './runtimeTransportEffectService.js';
|
|
5
6
|
interface RuntimeHostingServiceDeps {
|
|
6
7
|
config: AppliedMoorlineConfig;
|
|
7
8
|
transport: RuntimeTransport;
|
|
9
|
+
effects: RuntimeTransportEffectService;
|
|
8
10
|
managementSurface: RuntimeManagementSurfaceHandle;
|
|
9
11
|
installationPath: string;
|
|
10
12
|
now(): string;
|
|
@@ -16,7 +18,7 @@ interface RuntimeHostingServiceDeps {
|
|
|
16
18
|
}
|
|
17
19
|
interface RuntimeHostingHandlers {
|
|
18
20
|
actions: RuntimeActionDefinition[];
|
|
19
|
-
|
|
21
|
+
onTransportIntent(intent: RuntimeTransportIntent): Promise<void>;
|
|
20
22
|
}
|
|
21
23
|
export declare class RuntimeHostingService {
|
|
22
24
|
private readonly deps;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { defaultAdminConfig } from '../../../types/config.js';
|
|
2
1
|
import { loadInstallationState, saveInstallationState } from '../../system/config/configStore.js';
|
|
3
2
|
export class RuntimeHostingService {
|
|
4
3
|
deps;
|
|
@@ -24,18 +23,23 @@ export class RuntimeHostingService {
|
|
|
24
23
|
rollbackSteps.push(async () => {
|
|
25
24
|
await this.deps.managementSurface.stop();
|
|
26
25
|
});
|
|
27
|
-
if (this.deps.transport.capabilities().nativeActions
|
|
26
|
+
if (this.deps.transport.capabilities().nativeActions) {
|
|
28
27
|
await this.deps.authorizeTransportSetup({
|
|
29
28
|
target: this.deps.config.transport.scopeId ?? this.deps.config.transport.packageId,
|
|
30
|
-
execute: async () => await this.deps.
|
|
29
|
+
execute: async () => await this.deps.effects.registerActions('runtime:hosting', {
|
|
31
30
|
scopeId: this.deps.config.transport.scopeId ?? '',
|
|
32
31
|
actions: handlers.actions
|
|
33
32
|
})
|
|
34
33
|
});
|
|
35
34
|
}
|
|
36
|
-
this.deps.transport.
|
|
37
|
-
|
|
38
|
-
|
|
35
|
+
if (this.deps.transport.onIntent) {
|
|
36
|
+
this.deps.transport.onIntent(async (intent) => {
|
|
37
|
+
await handlers.onTransportIntent(intent);
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
throw new Error('Transport must implement onIntent.');
|
|
42
|
+
}
|
|
39
43
|
return surfaceState;
|
|
40
44
|
}
|
|
41
45
|
catch (error) {
|
|
@@ -77,38 +81,15 @@ export class RuntimeHostingService {
|
|
|
77
81
|
}
|
|
78
82
|
async bootstrapSurface() {
|
|
79
83
|
const existing = loadInstallationState(this.deps.installationPath);
|
|
80
|
-
const transportConfig = this.deps.config.transport.config;
|
|
81
|
-
if (this.deps.transport.reconcileRuntimeSurface) {
|
|
82
|
-
const adminConfig = this.deps.config.admin ?? defaultAdminConfig();
|
|
83
|
-
const reconciled = await this.deps.authorizeTransportSetup({
|
|
84
|
-
target: this.deps.config.transport.scopeId ?? this.deps.config.transport.packageId ?? 'transport',
|
|
85
|
-
execute: async () => await this.deps.transport.reconcileRuntimeSurface({
|
|
86
|
-
scopeId: this.deps.config.transport.scopeId,
|
|
87
|
-
actorId: typeof transportConfig.actorId === 'string' ? transportConfig.actorId : undefined,
|
|
88
|
-
names: this.deps.config.surface,
|
|
89
|
-
managedAdminAccessGroup: adminConfig.managedRole,
|
|
90
|
-
managedMemberAccessGroup: adminConfig.managedUserRole,
|
|
91
|
-
explicitAdminRoleIds: adminConfig.accessGroupIds,
|
|
92
|
-
explicitAdminUserIds: adminConfig.userIds,
|
|
93
|
-
previousState: existing,
|
|
94
|
-
nowIso: this.deps.now(),
|
|
95
|
-
config: transportConfig
|
|
96
|
-
})
|
|
97
|
-
});
|
|
98
|
-
saveInstallationState(this.deps.installationPath, reconciled);
|
|
99
|
-
return reconciled;
|
|
100
|
-
}
|
|
101
84
|
if (existing && (!this.deps.config.transport.scopeId || existing.scopeId === this.deps.config.transport.scopeId)) {
|
|
102
85
|
return existing;
|
|
103
86
|
}
|
|
104
87
|
const nowIso = this.deps.now();
|
|
105
88
|
const defaultState = {
|
|
106
89
|
scopeId: this.deps.config.transport.scopeId,
|
|
107
|
-
|
|
108
|
-
coordinationResourceId: this.deps.config.surface.coordinationResourceName,
|
|
90
|
+
surfaceId: this.deps.config.transport.scopeId ?? this.deps.config.transport.packageId,
|
|
109
91
|
statusResourceId: this.deps.config.surface.statusResourceName,
|
|
110
|
-
|
|
111
|
-
archiveCategoryId: this.deps.config.surface.archiveGroupName,
|
|
92
|
+
coordinationResourceId: this.deps.config.surface.coordinationResourceName,
|
|
112
93
|
createdAt: nowIso,
|
|
113
94
|
updatedAt: nowIso
|
|
114
95
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtimeHostingService.js","sourceRoot":"","sources":["../../../../../../../src/core/runtime/hosting/runtimeHostingService.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"runtimeHostingService.js","sourceRoot":"","sources":["../../../../../../../src/core/runtime/hosting/runtimeHostingService.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAqBlG,MAAM,OAAO,qBAAqB;IAGH;IAFrB,cAAc,GAAkB,IAAI,CAAC;IAE7C,YAA6B,IAA+B;QAA/B,SAAI,GAAJ,IAAI,CAA2B;IAAG,CAAC;IAEhE,KAAK,CAAC,KAAK,CAAC,QAAgC;QAC1C,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;QAC3B,MAAM,aAAa,GAA+B,EAAE,CAAC;QACrD,IAAI,CAAC;YACH,MAAM,IAAI,CAAC,iBAAiB,EAAE,CAAC;YAC/B,MAAM,eAAe,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC;YAC1D,MAAM,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC;gBAC9B,KAAK,EAAE,OAAO,eAAe,CAAC,SAAS,KAA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CAAC,GAAG,EAAE,CAAC;QAC/B,MAAM,YAAY,GAAwB;YACxC,OAAO,EAAE,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,OAAO;YAC3C,SAAS,EAAE,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,OAAO,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,SAAS;YACrF,gBAAgB,EAAE,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,kBAAkB;YAC7D,sBAAsB,EAAE,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,wBAAwB;YACzE,SAAS,EAAE,MAAM;YACjB,SAAS,EAAE,MAAM;SAClB,CAAC;QACF,qBAAqB,CAAC,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE,YAAY,CAAC,CAAC;QAChE,OAAO,YAAY,CAAC;IACtB,CAAC;CAEF"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { RuntimeActionGuard } from '../../system/policy/runtimeActionGuard.js';
|
|
2
|
+
import type { RuntimeMessagePayload, RuntimeMessageTarget, RuntimeNativeActionRegistration, RuntimePresenceInput, RuntimeTransport, RuntimeTransportEffectReceipt, RuntimeCreateTransportResourceInput, RuntimeTransportResourceRecord, RuntimeUpdateTransportResourceInput, RuntimeDeleteTransportResourceInput } from '../../../types/transport.js';
|
|
3
|
+
interface RuntimeTransportEffectServiceDeps {
|
|
4
|
+
queue<T>(key: string, work: () => Promise<T>): Promise<T>;
|
|
5
|
+
guard(): RuntimeActionGuard;
|
|
6
|
+
transport(): RuntimeTransport;
|
|
7
|
+
now(): string;
|
|
8
|
+
appendAuditEvent(event: string, payload: Record<string, unknown>): void;
|
|
9
|
+
}
|
|
10
|
+
export declare class RuntimeTransportEffectService {
|
|
11
|
+
private readonly deps;
|
|
12
|
+
constructor(deps: RuntimeTransportEffectServiceDeps);
|
|
13
|
+
sendMessage(actor: string, target: RuntimeMessageTarget, payload: RuntimeMessagePayload): Promise<RuntimeTransportEffectReceipt>;
|
|
14
|
+
createResource(actor: string, input: RuntimeCreateTransportResourceInput): Promise<RuntimeTransportResourceRecord>;
|
|
15
|
+
updateResource(actor: string, input: RuntimeUpdateTransportResourceInput): Promise<RuntimeTransportEffectReceipt>;
|
|
16
|
+
deleteResource(actor: string, input: RuntimeDeleteTransportResourceInput): Promise<RuntimeTransportEffectReceipt>;
|
|
17
|
+
setPresence(actor: string, input: RuntimePresenceInput): Promise<RuntimeTransportEffectReceipt>;
|
|
18
|
+
registerActions(actor: string, input: RuntimeNativeActionRegistration): Promise<RuntimeTransportEffectReceipt>;
|
|
19
|
+
private applyQueued;
|
|
20
|
+
private apply;
|
|
21
|
+
}
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { randomUUID } from 'node:crypto';
|
|
2
|
+
export class RuntimeTransportEffectService {
|
|
3
|
+
deps;
|
|
4
|
+
constructor(deps) {
|
|
5
|
+
this.deps = deps;
|
|
6
|
+
}
|
|
7
|
+
async sendMessage(actor, target, payload) {
|
|
8
|
+
return await this.applyQueued(actor, target.transportResourceId, {
|
|
9
|
+
type: 'transport.message.send',
|
|
10
|
+
effectId: randomUUID(),
|
|
11
|
+
scopeId: target.scopeId,
|
|
12
|
+
target,
|
|
13
|
+
payload,
|
|
14
|
+
createdAt: this.deps.now()
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
async createResource(actor, input) {
|
|
18
|
+
const receipt = await this.applyQueued(actor, `${input.scopeId}:${input.name}`, {
|
|
19
|
+
type: 'transport.resource.create',
|
|
20
|
+
effectId: randomUUID(),
|
|
21
|
+
scopeId: input.scopeId,
|
|
22
|
+
input,
|
|
23
|
+
createdAt: this.deps.now()
|
|
24
|
+
});
|
|
25
|
+
const resource = receipt.metadata?.resource;
|
|
26
|
+
if (resource && typeof resource === 'object') {
|
|
27
|
+
return resource;
|
|
28
|
+
}
|
|
29
|
+
throw new Error('Transport resource create effect did not return resource metadata.');
|
|
30
|
+
}
|
|
31
|
+
async updateResource(actor, input) {
|
|
32
|
+
return await this.applyQueued(actor, input.transportResourceId, {
|
|
33
|
+
type: 'transport.resource.update',
|
|
34
|
+
effectId: randomUUID(),
|
|
35
|
+
scopeId: input.scopeId,
|
|
36
|
+
input,
|
|
37
|
+
createdAt: this.deps.now()
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
async deleteResource(actor, input) {
|
|
41
|
+
return await this.applyQueued(actor, input.transportResourceId, {
|
|
42
|
+
type: 'transport.resource.delete',
|
|
43
|
+
effectId: randomUUID(),
|
|
44
|
+
scopeId: input.scopeId,
|
|
45
|
+
input,
|
|
46
|
+
createdAt: this.deps.now()
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
async setPresence(actor, input) {
|
|
50
|
+
return await this.applyQueued(actor, input.transportResourceId ?? input.scopeId ?? 'transport:presence', {
|
|
51
|
+
type: 'transport.presence.set',
|
|
52
|
+
effectId: randomUUID(),
|
|
53
|
+
scopeId: input.scopeId,
|
|
54
|
+
input,
|
|
55
|
+
createdAt: this.deps.now()
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
async registerActions(actor, input) {
|
|
59
|
+
return await this.applyQueued(actor, `${input.scopeId}:actions`, {
|
|
60
|
+
type: 'transport.actions.register',
|
|
61
|
+
effectId: randomUUID(),
|
|
62
|
+
scopeId: input.scopeId,
|
|
63
|
+
input,
|
|
64
|
+
createdAt: this.deps.now()
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
async applyQueued(actor, key, effect) {
|
|
68
|
+
return await this.deps.queue(key, async () => await this.deps.guard().run({
|
|
69
|
+
action: effect.type,
|
|
70
|
+
actor,
|
|
71
|
+
target: key,
|
|
72
|
+
execute: async () => await this.apply(effect)
|
|
73
|
+
}));
|
|
74
|
+
}
|
|
75
|
+
async apply(effect) {
|
|
76
|
+
const transport = this.deps.transport();
|
|
77
|
+
const receipt = await transport.applyEffect(effect);
|
|
78
|
+
this.deps.appendAuditEvent('transport.effect.applied', {
|
|
79
|
+
effectId: effect.effectId,
|
|
80
|
+
type: effect.type,
|
|
81
|
+
nativeId: receipt.nativeId ?? null
|
|
82
|
+
});
|
|
83
|
+
return receipt;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
//# sourceMappingURL=runtimeTransportEffectService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtimeTransportEffectService.js","sourceRoot":"","sources":["../../../../../../../src/core/runtime/hosting/runtimeTransportEffectService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAwBzC,MAAM,OAAO,6BAA6B;IACX;IAA7B,YAA6B,IAAuC;QAAvC,SAAI,GAAJ,IAAI,CAAmC;IAAG,CAAC;IAExE,KAAK,CAAC,WAAW,CAAC,KAAa,EAAE,MAA4B,EAAE,OAA8B;QAC3F,OAAO,MAAM,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,MAAM,CAAC,mBAAmB,EAAE;YAC/D,IAAI,EAAE,wBAAwB;YAC9B,QAAQ,EAAE,UAAU,EAAE;YACtB,OAAO,EAAE,MAAM,CAAC,OAAO;YACvB,MAAM;YACN,OAAO;YACP,SAAS,EAAE,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE;SAC3B,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,cAAc,CAAC,KAAa,EAAE,KAA0C;QAC5E,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,GAAG,KAAK,CAAC,OAAO,IAAI,KAAK,CAAC,IAAI,EAAE,EAAE;YAC9E,IAAI,EAAE,2BAA2B;YACjC,QAAQ,EAAE,UAAU,EAAE;YACtB,OAAO,EAAE,KAAK,CAAC,OAAO;YACtB,KAAK;YACL,SAAS,EAAE,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE;SAC3B,CAAC,CAAC;QACH,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ntimeTransportIntent } from '../../../types/transport.js';
|
|
3
|
+
import type { SqliteSessionStore } from '../../system/state/sqliteSessionStore.js';
|
|
4
|
+
import type { RuntimeWorkManagementService } from '../../domain/sessions/runtimeWorkManagementService.js';
|
|
5
|
+
import type { RuntimeInteractionService } from '../execution/runtimeInteractionService.js';
|
|
6
|
+
interface RuntimeTransportIntentServiceDeps {
|
|
7
|
+
config: AppliedMoorlineConfig;
|
|
8
|
+
store: SqliteSessionStore;
|
|
9
|
+
workManagement: RuntimeWorkManagementService;
|
|
10
|
+
interactions: RuntimeInteractionService;
|
|
11
|
+
now(): string;
|
|
12
|
+
appendAuditEvent(event: string, payload: Record<string, unknown>): void;
|
|
13
|
+
}
|
|
14
|
+
export declare class RuntimeTransportIntentService {
|
|
15
|
+
private readonly deps;
|
|
16
|
+
constructor(deps: RuntimeTransportIntentServiceDeps);
|
|
17
|
+
handleIntent(intent: RuntimeTransportIntent): Promise<void>;
|
|
18
|
+
drainPendingIntents(limit?: number): Promise<number>;
|
|
19
|
+
private processRecordedIntent;
|
|
20
|
+
private processIntent;
|
|
21
|
+
private resumeSessionForMessageIfNeeded;
|
|
22
|
+
}
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
function transportActorId(intent) {
|
|
2
|
+
if ('actor' in intent && intent.actor?.actorId) {
|
|
3
|
+
return intent.actor.actorId;
|
|
4
|
+
}
|
|
5
|
+
return `transport:${intent.transportPackageId ?? 'unknown'}`;
|
|
6
|
+
}
|
|
7
|
+
function intentQueueKey(intent) {
|
|
8
|
+
if ('transportResourceId' in intent && typeof intent.transportResourceId === 'string') {
|
|
9
|
+
return intent.transportResourceId;
|
|
10
|
+
}
|
|
11
|
+
if (intent.type === 'transport.resource.observed') {
|
|
12
|
+
return intent.resource.id;
|
|
13
|
+
}
|
|
14
|
+
return `transport:${intent.scopeId}:${intent.type}`;
|
|
15
|
+
}
|
|
16
|
+
export class RuntimeTransportIntentService {
|
|
17
|
+
deps;
|
|
18
|
+
constructor(deps) {
|
|
19
|
+
this.deps = deps;
|
|
20
|
+
}
|
|
21
|
+
async handleIntent(intent) {
|
|
22
|
+
if (intent.scopeId !== this.deps.config.transport.scopeId) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
const inserted = this.deps.store.appendTransportIntent(intent).inserted;
|
|
26
|
+
if (!inserted) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
await this.processRecordedIntent(intent);
|
|
30
|
+
}
|
|
31
|
+
async drainPendingIntents(limit = 100) {
|
|
32
|
+
let drained = 0;
|
|
33
|
+
while (true) {
|
|
34
|
+
const pending = this.deps.store.listPendingTransportIntents(limit).filter((intent) => intent.scopeId === this.deps.config.transport.scopeId);
|
|
35
|
+
if (pending.length === 0) {
|
|
36
|
+
return drained;
|
|
37
|
+
}
|
|
38
|
+
drained += pending.length;
|
|
39
|
+
for (const intent of pending) {
|
|
40
|
+
try {
|
|
41
|
+
await this.processRecordedIntent(intent);
|
|
42
|
+
}
|
|
43
|
+
catch {
|
|
44
|
+
// Failed pending intents are marked by processRecordedIntent and should not block later intents.
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
async processRecordedIntent(intent) {
|
|
50
|
+
try {
|
|
51
|
+
await this.processIntent(intent);
|
|
52
|
+
this.deps.store.markTransportIntentProcessed(intent.intentId, this.deps.now());
|
|
53
|
+
}
|
|
54
|
+
catch (error) {
|
|
55
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
56
|
+
this.deps.store.markTransportIntentFailed(intent.intentId, this.deps.now(), message);
|
|
57
|
+
this.deps.appendAuditEvent('transport.intent.failed', {
|
|
58
|
+
intentId: intent.intentId,
|
|
59
|
+
type: intent.type,
|
|
60
|
+
key: intentQueueKey(intent),
|
|
61
|
+
error: message
|
|
62
|
+
});
|
|
63
|
+
throw error;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
async processIntent(intent) {
|
|
67
|
+
switch (intent.type) {
|
|
68
|
+
case 'transport.message.received':
|
|
69
|
+
await this.resumeSessionForMessageIfNeeded(intent);
|
|
70
|
+
await this.deps.interactions.handleTransportIntent(intent);
|
|
71
|
+
return;
|
|
72
|
+
case 'transport.action.invoked':
|
|
73
|
+
await this.deps.interactions.handleTransportIntent(intent);
|
|
74
|
+
return;
|
|
75
|
+
case 'transport.session.ensure': {
|
|
76
|
+
const session = await this.deps.workManagement.bindManagedSessionToTransportResource({
|
|
77
|
+
actorId: transportActorId(intent),
|
|
78
|
+
transportResourceId: intent.transportResourceId,
|
|
79
|
+
transportResourceName: intent.requestedName,
|
|
80
|
+
requestedName: intent.requestedName,
|
|
81
|
+
runtimeMode: intent.runtimeMode ?? this.deps.config.defaults.runtimeMode,
|
|
82
|
+
owner: intent.owner
|
|
83
|
+
});
|
|
84
|
+
if (intent.initialMessage && intent.actor) {
|
|
85
|
+
await this.deps.interactions.handleTransportIntent({
|
|
86
|
+
...intent,
|
|
87
|
+
intentId: `${intent.intentId}:initial-message`,
|
|
88
|
+
occurredAt: this.deps.now(),
|
|
89
|
+
type: 'transport.message.received',
|
|
90
|
+
transportResourceId: session.transportResourceId,
|
|
91
|
+
actor: intent.actor,
|
|
92
|
+
message: intent.initialMessage
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
case 'transport.session.delete':
|
|
98
|
+
await this.deps.workManagement.deleteManagedSessionNow({
|
|
99
|
+
actorId: transportActorId(intent),
|
|
100
|
+
transportResourceId: intent.transportResourceId,
|
|
101
|
+
deleteWorkspace: intent.deleteWorkspace,
|
|
102
|
+
reason: intent.reason
|
|
103
|
+
});
|
|
104
|
+
return;
|
|
105
|
+
case 'transport.session.archive':
|
|
106
|
+
await this.deps.workManagement.archiveManagedSession({
|
|
107
|
+
actorId: transportActorId(intent),
|
|
108
|
+
transportResourceId: intent.transportResourceId
|
|
109
|
+
});
|
|
110
|
+
return;
|
|
111
|
+
case 'transport.session.resume':
|
|
112
|
+
await this.deps.workManagement.resumeManagedSession({
|
|
113
|
+
actorId: transportActorId(intent),
|
|
114
|
+
transportResourceId: intent.transportResourceId,
|
|
115
|
+
reason: intent.reason
|
|
116
|
+
});
|
|
117
|
+
return;
|
|
118
|
+
case 'transport.resource.observed':
|
|
119
|
+
this.deps.appendAuditEvent('transport.resource.observed', {
|
|
120
|
+
scopeId: intent.scopeId,
|
|
121
|
+
resourceId: intent.resource.id,
|
|
122
|
+
resourceName: intent.resource.name,
|
|
123
|
+
action: intent.action,
|
|
124
|
+
parentId: intent.resource.parentId ?? null
|
|
125
|
+
});
|
|
126
|
+
return;
|
|
127
|
+
case 'transport.external.received':
|
|
128
|
+
await this.deps.interactions.handleTransportIntent(intent);
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
async resumeSessionForMessageIfNeeded(intent) {
|
|
133
|
+
const session = this.deps.store.getSessionByTransportResourceId(intent.transportResourceId);
|
|
134
|
+
if (!session || session.lifecycleStatus !== 'archived') {
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
await this.deps.workManagement.resumeManagedSession({
|
|
138
|
+
actorId: intent.actor.actorId,
|
|
139
|
+
transportResourceId: intent.transportResourceId,
|
|
140
|
+
reason: 'Transport message received for archived session'
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
//# sourceMappingURL=runtimeTransportIntentService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtimeTransportIntentService.js","sourceRoot":"","sources":["../../../../../../../src/core/runtime/hosting/runtimeTransportIntentService.ts"],"names":[],"mappings":"AAeA,SAAS,gBAAgB,CAAC,MAA8B;IACtD,IAAI,OAAO,IAAI,MAAM,IAAI,MAAM,CAAC,KAAK,EAAE,OAAO,EAAE,CAAC;QAC/C,OAAO,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC;IAC9B,CAAC;IACD,OAAO,aAAa,MAAM,C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AK,CAAC,+BAA+B,CAC3C,MAA+E;QAE/E,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,+BAA+B,CAAC,MAAM,CAAC,mBAAmB,CAAC,CAAC;QAC5F,IAAI,CAAC,OAAO,IAAI,OAAO,CAAC,eAAe,KAAK,UAAU,EAAE,CAAC;YACvD,OAAO;QACT,CAAC;QACD,MAAM,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,oBAAoB,CAAC;YAClD,OAAO,EAAE,MAAM,CAAC,KAAK,CAAC,OAAO;YAC7B,mBAAmB,EAAE,MAAM,CAAC,mBAAmB;YAC/C,MAAM,EAAE,iDAAiD;SAC1D,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import type { RuntimeActionGuard } from '../../system/policy/runtimeActionGuard.js';
|
|
2
1
|
import type { RuntimeMessagePayload, RuntimeTransport } from '../../../types/transport.js';
|
|
3
2
|
import type { RuntimeSurfaceState } from '../../../types/config.js';
|
|
3
|
+
import type { RuntimeTransportEffectService } from './runtimeTransportEffectService.js';
|
|
4
4
|
interface RuntimeTransportSurfaceServiceDeps {
|
|
5
|
-
queue<T>(key: string, work: () => Promise<T>): Promise<T>;
|
|
6
|
-
guard(): RuntimeActionGuard;
|
|
7
5
|
transport(): RuntimeTransport;
|
|
6
|
+
effects(): RuntimeTransportEffectService;
|
|
8
7
|
getSurfaceState(): RuntimeSurfaceState | null;
|
|
9
8
|
}
|
|
10
9
|
export declare class RuntimeTransportSurfaceService {
|
|
@@ -1,44 +1,9 @@
|
|
|
1
|
-
const TYPING_REFRESH_MS = 8_000;
|
|
2
1
|
export class RuntimeTransportSurfaceService {
|
|
3
2
|
deps;
|
|
4
3
|
constructor(deps) {
|
|
5
4
|
this.deps = deps;
|
|
6
5
|
}
|
|
7
6
|
startTypingLoop(actor, transportResourceId) {
|
|
8
|
-
const transport = this.deps.transport();
|
|
9
|
-
if (typeof transport.triggerTyping === 'function') {
|
|
10
|
-
let stopped = false;
|
|
11
|
-
let interval = null;
|
|
12
|
-
const trigger = async () => {
|
|
13
|
-
try {
|
|
14
|
-
await this.deps.queue(transportResourceId, async () => await this.deps.guard().run({
|
|
15
|
-
action: 'transport.message.send',
|
|
16
|
-
actor,
|
|
17
|
-
target: `${transportResourceId}:typing`,
|
|
18
|
-
execute: async () => {
|
|
19
|
-
await transport.triggerTyping?.(transportResourceId);
|
|
20
|
-
}
|
|
21
|
-
}));
|
|
22
|
-
}
|
|
23
|
-
catch {
|
|
24
|
-
// Typing indicator failures are cosmetic.
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
void trigger();
|
|
28
|
-
interval = globalThis.setInterval(() => {
|
|
29
|
-
if (stopped) {
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
void trigger();
|
|
33
|
-
}, TYPING_REFRESH_MS);
|
|
34
|
-
return () => {
|
|
35
|
-
stopped = true;
|
|
36
|
-
if (interval) {
|
|
37
|
-
globalThis.clearInterval(interval);
|
|
38
|
-
interval = null;
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
7
|
void this.setPresence(actor, transportResourceId, 'busy');
|
|
43
8
|
return () => {
|
|
44
9
|
void this.setPresence(actor, transportResourceId, 'online');
|
|
@@ -46,37 +11,24 @@ export class RuntimeTransportSurfaceService {
|
|
|
46
11
|
}
|
|
47
12
|
async setPresence(actor, transportResourceId, status) {
|
|
48
13
|
const transport = this.deps.transport();
|
|
49
|
-
if (!transport.capabilities().presence
|
|
14
|
+
if (!transport.capabilities().presence) {
|
|
50
15
|
return;
|
|
51
16
|
}
|
|
52
|
-
await this.deps.
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
execute: async () => {
|
|
57
|
-
await transport.setPresence?.({
|
|
58
|
-
transportResourceId: transportResourceId,
|
|
59
|
-
status
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
}));
|
|
17
|
+
await this.deps.effects().setPresence(actor, {
|
|
18
|
+
transportResourceId: transportResourceId,
|
|
19
|
+
status
|
|
20
|
+
});
|
|
63
21
|
}
|
|
64
22
|
async postMessage(actor, transportResourceId, payload) {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
actor,
|
|
68
|
-
target: transportResourceId,
|
|
69
|
-
execute: async () => {
|
|
70
|
-
return await this.deps.transport().sendMessage({ transportResourceId: transportResourceId }, payload);
|
|
71
|
-
}
|
|
72
|
-
}));
|
|
23
|
+
const receipt = await this.deps.effects().sendMessage(actor, { transportResourceId }, payload);
|
|
24
|
+
return { id: receipt.nativeId ?? receipt.effectId };
|
|
73
25
|
}
|
|
74
26
|
async sendStatusUpdate(payload) {
|
|
75
27
|
const surface = this.deps.getSurfaceState();
|
|
76
28
|
if (!surface) {
|
|
77
29
|
return;
|
|
78
30
|
}
|
|
79
|
-
await this.postMessage('runtime:status', surface.statusResourceId, payload);
|
|
31
|
+
await this.postMessage('runtime:status', surface.statusResourceId ?? surface.scopeId ?? surface.surfaceId, payload);
|
|
80
32
|
}
|
|
81
33
|
}
|
|
82
34
|
//# sourceMappingURL=runtimeTransportSurfaceService.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtimeTransportSurfaceService.js","sourceRoot":"","sources":["../../../../../../../src/core/runtime/hosting/runtimeTransportSurfaceService.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"runtimeTransportSurfaceService.js","sourceRoot":"","sources":["../../../../../../../src/core/runtime/hosting/runtimeTransportSurfaceService.ts"],"names":[],"mappings":"AAUA,MAAM,OAAO,8BAA8B;IACZ;IAA7B,YAA6B,IAAwC;QAAxC,SAAI,GAAJ,IAAI,CAAoC;IAAG,CAAC;IAEzE,eAAe,CAAC,KAAa,EAAE,mBAA2B;QACxD,KAAK,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,mBAAmB,EAAE,MAAM,CAAC,CAAC;QAC1D,OAAO,GAAG,EAAE;YACV,KAAK,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,mBAAmB,EAAE,QAAQ,CAAC,CAAC;QAC9D,CAAC,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,KAAa,EAAE,mBAA2B,EAAE,MAA8C;QAC1G,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC;QACxC,IAAI,CAAC,SAAS,CAAC,YAAY,EAAE,CAAC,QAAQ,EAAE,CAAC;YACvC,OAAO;QACT,CAAC;QACD,MAAM,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,WAAW,CAAC,KAAK,EAAE;YAC3C,mBAAmB,EAAE,mBAAmB;YACxC,MAAM;SACP,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,KAAa,EAAE,mBAA2B,EAAE,OAA8B;QAC1F,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,WAAW,CAAC,KAAK,EAAE,EAAE,mBAAmB,EAAE,EAAE,OAAO,CAAC,CAAC;QAC/F,OAAO,EAAE,EAAE,EAAE,OAAO,CAAC,QAAQ,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC;IACtD,CAAC;IAED,KAAK,CAAC,gBAAgB,CAAC,OAA8B;QACnD,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE,CAAC;QAC5C,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,OAAO;QACT,CAAC;QACD,MAAM,IAAI,CAAC,WAAW,CAAC,gBAAgB,EAAE,OAAO,CAAC,gBAAgB,IAAI,OAAO,CAAC,OAAO,IAAI,OAAO,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IACtH,CAAC;CACF"}
|
|
@@ -59,19 +59,6 @@ export class RuntimeLifecycleService {
|
|
|
59
59
|
if (!current || current.lifecycleStatus === 'archived') {
|
|
60
60
|
return;
|
|
61
61
|
}
|
|
62
|
-
const surface = this.deps.getSurfaceState();
|
|
63
|
-
if (surface) {
|
|
64
|
-
await this.deps.requireGuard().run({
|
|
65
|
-
action: 'transport.resource.update',
|
|
66
|
-
actor: 'runtime:lifecycle/archive',
|
|
67
|
-
target: current.transportResourceId,
|
|
68
|
-
execute: async () => this.deps.transport.updateTransportResource?.({
|
|
69
|
-
scopeId: this.deps.transportScopeId,
|
|
70
|
-
transportResourceId: current.transportResourceId,
|
|
71
|
-
parentId: surface.archiveCategoryId
|
|
72
|
-
})
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
62
|
const archived = this.deps.sessionRegistry.updateSession({
|
|
76
63
|
...current,
|
|
77
64
|
lifecycleStatus: 'archived',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtimeLifecycleService.js","sourceRoot":"","sources":["../../../../../../../src/core/runtime/lifecycle/runtimeLifecycleService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,0BAA0B,EAAE,MAAM,iDAAiD,CAAC;AAyB7F,SAAS,oBAAoB,CAAC,MAA4C;IACxE,QAAQ,MAAM,EAAE,CAAC;QACf,KAAK,KAAK;YACR,OAAO,QAAQ,CAAC;QAClB,KAAK,MAAM;YACT,OAAO,SAAS,CAAC;QACnB,KAAK,UAAU;YACb,OAAO,UAAU,CAAC;IACtB,CAAC;AACH,CAAC;AAED,MAAM,OAAO,uBAAuB;IAGL;IAFrB,KAAK,GAAqD,IAAI,CAAC;IAEvE,YAA6B,IAAiC;QAAjC,SAAI,GAAJ,IAAI,CAA6B;IAAG,CAAC;IAElE,KAAK;QACH,IAAI,CAAC,IAAI,EAAE,CAAC;QACZ,MAAM,IAAI,GAAG,GAAG,EAAE;YAChB,KAAK,IAAI,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE;gBACxC,IAAI,CAAC,IAAI,CAAC,sBAAsB,CAAC,KAAK,CAAC,CAAC;YAC1C,CAAC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AAC;IACH,CAAC;IAEO,KAAK,CAAC,wBAAwB,CACpC,OAA0B,EAC1B,UAOC;QAED,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,aAAa,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QAC1E,IAAI,CAAC,OAAO,IAAI,OAAO,CAAC,eAAe,KAAK,UAAU,EAAE,CAAC;YACvD,OAAO;QACT,CAAC;QAED,MAAM,
|
|
1
|
+
{"version":3,"file":"runtimeLifecycleService.js","sourceRoot":"","sources":["../../../../../../../src/core/runtime/lifecycle/runtimeLifecycleService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,0BAA0B,EAAE,MAAM,iDAAiD,CAAC;AAyB7F,SAAS,oBAAoB,CAAC,MAA4C;IACxE,QAAQ,MAAM,EAAE,CAAC;QACf,KAAK,KAAK;YACR,OAAO,QAAQ,CAAC;QAClB,KAAK,MAAM;YACT,OAAO,SAAS,CAAC;QACnB,KAAK,UAAU;YACb,OAAO,UAAU,CAAC;IACtB,CAAC;AACH,CAAC;AAED,MAAM,OAAO,uBAAuB;IAGL;IAFrB,KAAK,GAAqD,IAAI,CAAC;IAEvE,YAA6B,IAAiC;QAAjC,SAAI,GAAJ,IAAI,CAA6B;IAAG,CAAC;IAElE,KAAK;QACH,IAAI,CAAC,IAAI,EAAE,CAAC;QACZ,MAAM,IAAI,GAAG,GAAG,EAAE;YAChB,KAAK,IAAI,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE;gBACxC,IAAI,CAAC,IAAI,CAAC,sBAAsB,CAAC,KAAK,CAAC,CAAC;YAC1C,CAAC,CAAC,CAAC;QACL,CAAC,CAAC;QACF,IAAI,EAAE,CAAC;QACP,IAAI,CAAC,KAAK,GAAG,WAAW,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACzC,CAAC;IAED,IAAI;QACF,IAAI,I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CAAC,CAAC;QAC1E,IAAI,CAAC,OAAO,IAAI,OAAO,CAAC,eAAe,KAAK,UAAU,EAAE,CAAC;YACvD,OAAO;QACT,CAAC;QAED,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,aAAa,CAAC;YACvD,GAAG,OAAO;YACV,eAAe,EAAE,UAAU;YAC3B,UAAU,EAAE,UAAU,CAAC,EAAE;YACzB,SAAS,EAAE,UAAU,CAAC,EAAE;SACzB,CAAC,CAAC;QACH,MAAM,IAAI,CAAC,IAAI,CAAC,qBAAqB,CAAC,SAAS,EAAE,QAAQ,CAAC,SAAS,EAAE,WAAW,QAAQ,CAAC,SAAS,wBAAwB,CAAC,CAAC;QAC5H,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,4BAA4B,EAAE;YACvD,SAAS,EAAE,QAAQ,CAAC,SAAS;YAC7B,mBAAmB,EAAE,QAAQ,CAAC,mBAAmB;YACjD,aAAa,EAAE,UAAU,CAAC,IAAI;YAC9B,OAAO,EAAE,2BAA2B;YACpC,aAAa,EAAE,UAAU,EAAE;SAC5B,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -28,8 +28,8 @@ export declare class MoorlineRuntime {
|
|
|
28
28
|
private readonly managementReadModel;
|
|
29
29
|
private readonly runtimeControl;
|
|
30
30
|
private readonly workManagement;
|
|
31
|
-
private readonly managedTransportResourceLifecycle;
|
|
32
31
|
private readonly interactions;
|
|
32
|
+
private readonly transportIntents;
|
|
33
33
|
private readonly transportSurface;
|
|
34
34
|
private readonly providerOrchestrator;
|
|
35
35
|
private readonly projectionService;
|
|
@@ -43,8 +43,8 @@ export class MoorlineRuntime {
|
|
|
43
43
|
managementReadModel;
|
|
44
44
|
runtimeControl;
|
|
45
45
|
workManagement;
|
|
46
|
-
managedTransportResourceLifecycle;
|
|
47
46
|
interactions;
|
|
47
|
+
transportIntents;
|
|
48
48
|
transportSurface;
|
|
49
49
|
providerOrchestrator;
|
|
50
50
|
projectionService;
|
|
@@ -142,8 +142,8 @@ export class MoorlineRuntime {
|
|
|
142
142
|
this.managementReadModel = graph.managementReadModel;
|
|
143
143
|
this.runtimeControl = graph.runtimeControl;
|
|
144
144
|
this.workManagement = graph.workManagement;
|
|
145
|
-
this.managedTransportResourceLifecycle = graph.managedTransportResourceLifecycle;
|
|
146
145
|
this.interactions = graph.interactions;
|
|
146
|
+
this.transportIntents = graph.transportIntents;
|
|
147
147
|
this.transportSurface = graph.transportSurface;
|
|
148
148
|
this.providerOrchestrator = graph.providerOrchestrator;
|
|
149
149
|
this.projectionService = graph.projectionService;
|
|
@@ -181,13 +181,11 @@ export class MoorlineRuntime {
|
|
|
181
181
|
this.initializePolicyGuard();
|
|
182
182
|
this.surfaceState = await this.hostingService.start({
|
|
183
183
|
actions: this.pluginHost.listActions((pluginId) => this.createPluginContext(`plugin:${pluginId}`)),
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
await this.managedTransportResourceLifecycle.handleEvent(event);
|
|
187
|
-
}
|
|
188
|
-
await this.interactions.handleTransportEvent(event);
|
|
184
|
+
onTransportIntent: async (intent) => {
|
|
185
|
+
await this.transportIntents.handleIntent(intent);
|
|
189
186
|
}
|
|
190
187
|
});
|
|
188
|
+
await this.transportIntents.drainPendingIntents();
|
|
191
189
|
this.providerService.on('providerEvent', (event) => {
|
|
192
190
|
void this.providerQueue
|
|
193
191
|
.push(event.threadId, async () => {
|
|
@@ -370,13 +368,7 @@ export class MoorlineRuntime {
|
|
|
370
368
|
return this.guard;
|
|
371
369
|
}
|
|
372
370
|
getEffectiveAdminConfig() {
|
|
373
|
-
|
|
374
|
-
const managedAccessGroupId = adminConfig.managedRole.enabled === true ? this.surfaceState?.adminAccessGroupId ?? null : null;
|
|
375
|
-
const accessGroupIds = managedAccessGroupId ? Array.from(new Set([...adminConfig.accessGroupIds, managedAccessGroupId])) : adminConfig.accessGroupIds;
|
|
376
|
-
return {
|
|
377
|
-
...adminConfig,
|
|
378
|
-
accessGroupIds
|
|
379
|
-
};
|
|
371
|
+
return this.deps.config.admin ?? defaultAdminConfig();
|
|
380
372
|
}
|
|
381
373
|
createPluginContext(actorId) {
|
|
382
374
|
return this.pluginContexts.createContext(actorId);
|