@opengeni/worker-bundle 2.2.1-canary.36927100590001 → 2.2.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/activities/agent-turn/run-credentials.d.ts +0 -2
- package/dist/activities/scheduled-tasks.d.ts +35 -4
- package/dist/activities/types.d.ts +0 -3
- package/dist/activities/workspace-capture.d.ts +0 -2
- package/dist/{activities-control-4F2A734B.js → activities-control-55ECL47G.js} +20 -102
- package/dist/activities-control-55ECL47G.js.map +1 -0
- package/dist/{activities-turn-TESOIOEX.js → activities-turn-T7Y3BWYO.js} +7 -20
- package/dist/activities-turn-T7Y3BWYO.js.map +1 -0
- package/dist/{chunk-YG27NEMX.js → chunk-IJZU752L.js} +1 -34
- package/dist/chunk-IJZU752L.js.map +1 -0
- package/dist/{chunk-4PJTUBWQ.js → chunk-OWNLATJL.js} +11 -34
- package/dist/chunk-OWNLATJL.js.map +1 -0
- package/dist/index.js +2 -2
- package/dist/observability-metrics.d.ts +1 -16
- package/dist/workflow-bundle.js +12 -18
- package/dist/workflows/scheduled-tasks.d.ts +0 -4
- package/package.json +21 -21
- package/src/activities/agent-turn/claim.ts +1 -13
- package/src/activities/agent-turn/run-credentials.ts +0 -5
- package/src/activities/agent-turn/run.ts +0 -1
- package/src/activities/agent-turn/tool-environment.ts +0 -4
- package/src/activities/automations.ts +1 -23
- package/src/activities/goals.ts +8 -33
- package/src/activities/sandbox-lease.ts +0 -22
- package/src/activities/scheduled-tasks.ts +25 -89
- package/src/activities/site-auth-maintenance.ts +0 -1
- package/src/activities/types.ts +0 -3
- package/src/activities/workspace-capture.ts +2 -13
- package/src/observability-metrics.ts +1 -55
- package/src/workflows/scheduled-tasks.ts +13 -26
- package/dist/activities/agent-turn/credential-restriction.d.ts +0 -3
- package/dist/activities-control-4F2A734B.js.map +0 -1
- package/dist/activities-turn-TESOIOEX.js.map +0 -1
- package/dist/chunk-4PJTUBWQ.js.map +0 -1
- package/dist/chunk-YG27NEMX.js.map +0 -1
- package/src/activities/agent-turn/credential-restriction.ts +0 -14
|
@@ -2,18 +2,12 @@ import { createHash } from "node:crypto";
|
|
|
2
2
|
import { errorCodeToJSON } from "@opengeni/agent-proto";
|
|
3
3
|
import {
|
|
4
4
|
BundledSkillId,
|
|
5
|
-
CREDIT_GRANT_CLASSES,
|
|
6
5
|
SandboxBackend,
|
|
7
6
|
type SessionEventType,
|
|
8
7
|
type SkillReadKind,
|
|
9
8
|
type SkillUseSource,
|
|
10
9
|
} from "@opengeni/contracts";
|
|
11
|
-
import {
|
|
12
|
-
ACTIVE_USER_WINDOWS,
|
|
13
|
-
type ActiveUserWindow,
|
|
14
|
-
type CreditGrantTotals,
|
|
15
|
-
type SessionEventAppendPhaseObservation,
|
|
16
|
-
} from "@opengeni/db";
|
|
10
|
+
import type { SessionEventAppendPhaseObservation } from "@opengeni/db";
|
|
17
11
|
import {
|
|
18
12
|
natsSubscriptionTerminationCounter,
|
|
19
13
|
type EventBusOptions,
|
|
@@ -1128,54 +1122,6 @@ export function recordCreditBalanceGauges(
|
|
|
1128
1122
|
creditBalanceGaugeAccounts.set(observability, current);
|
|
1129
1123
|
}
|
|
1130
1124
|
|
|
1131
|
-
/**
|
|
1132
|
-
* Distinct managed people with authenticated browser activity in each fixed
|
|
1133
|
-
* window (migration 0565 presence). Every control worker publishes the same
|
|
1134
|
-
* global value, so dashboards must aggregate with `max()` across pods, never
|
|
1135
|
-
* `sum()`. API keys, services and embedded hosts are never counted.
|
|
1136
|
-
*/
|
|
1137
|
-
export function recordActiveUserGauges(
|
|
1138
|
-
observability: Observability,
|
|
1139
|
-
counts: Record<ActiveUserWindow, number>,
|
|
1140
|
-
): void {
|
|
1141
|
-
for (const window of ACTIVE_USER_WINDOWS) {
|
|
1142
|
-
observability.setGauge({
|
|
1143
|
-
name: "opengeni_active_users",
|
|
1144
|
-
help: "Distinct managed users with authenticated activity within the window (global; use max across pods).",
|
|
1145
|
-
labels: { window },
|
|
1146
|
-
value: counts[window],
|
|
1147
|
-
});
|
|
1148
|
-
}
|
|
1149
|
-
}
|
|
1150
|
-
|
|
1151
|
-
/**
|
|
1152
|
-
* Positive credit grants observed by the ledger trigger since migration 0565,
|
|
1153
|
-
* by closed class. These are cumulative database totals published as gauges by
|
|
1154
|
-
* every control worker: aggregate with `max()` across pods, then `increase()`.
|
|
1155
|
-
* Counting in the database covers the grants no application process writes:
|
|
1156
|
-
* the verified-signup trial grant (a setup trigger) and operator grants.
|
|
1157
|
-
*/
|
|
1158
|
-
export function recordCreditGrantGauges(
|
|
1159
|
-
observability: Observability,
|
|
1160
|
-
totals: CreditGrantTotals,
|
|
1161
|
-
): void {
|
|
1162
|
-
for (const grantClass of CREDIT_GRANT_CLASSES) {
|
|
1163
|
-
const total = totals[grantClass];
|
|
1164
|
-
observability.setGauge({
|
|
1165
|
-
name: "opengeni_credit_grants_total",
|
|
1166
|
-
help: "Positive credit grants observed in the ledger since migration 0565, by grant class (global cumulative; use max across pods).",
|
|
1167
|
-
labels: { grant_class: grantClass },
|
|
1168
|
-
value: total.count,
|
|
1169
|
-
});
|
|
1170
|
-
observability.setGauge({
|
|
1171
|
-
name: "opengeni_credit_granted_micros_total",
|
|
1172
|
-
help: "Credit micros granted in the ledger since migration 0565, by grant class (global cumulative; use max across pods).",
|
|
1173
|
-
labels: { grant_class: grantClass },
|
|
1174
|
-
value: total.micros,
|
|
1175
|
-
});
|
|
1176
|
-
}
|
|
1177
|
-
}
|
|
1178
|
-
|
|
1179
1125
|
/**
|
|
1180
1126
|
* The deployment-level runtime switch for the one-time verified signup trial
|
|
1181
1127
|
* credit (migration 0521): 1 while it allows grants, 0 when an operator has
|
|
@@ -7,7 +7,6 @@ import {
|
|
|
7
7
|
WorkflowIdReusePolicy,
|
|
8
8
|
} from "@temporalio/workflow";
|
|
9
9
|
import type { TurnInitiator } from "@opengeni/contracts";
|
|
10
|
-
import type { DispatchScheduledTaskRunInput } from "../activities/types";
|
|
11
10
|
import { scheduledTaskActivity } from "./activities";
|
|
12
11
|
import {
|
|
13
12
|
knowledgeSourceSyncWake,
|
|
@@ -27,38 +26,14 @@ export type ScheduledTaskFireWorkflowInput = ScheduledTaskFireWorkflowBase &
|
|
|
27
26
|
triggerType: "scheduled";
|
|
28
27
|
agentRunUsageIdempotencyKey?: never;
|
|
29
28
|
initiator?: never;
|
|
30
|
-
credentialRestriction?: never;
|
|
31
29
|
}
|
|
32
30
|
| {
|
|
33
31
|
triggerType: "manual" | "initial" | "provider_event" | "retry" | "repair";
|
|
34
32
|
agentRunUsageIdempotencyKey: string;
|
|
35
33
|
initiator: TurnInitiator;
|
|
36
|
-
credentialRestriction?: "developer_setup";
|
|
37
34
|
}
|
|
38
35
|
);
|
|
39
36
|
|
|
40
|
-
export function scheduledTaskDispatchInput(
|
|
41
|
-
input: ScheduledTaskFireWorkflowInput,
|
|
42
|
-
producerKey: string,
|
|
43
|
-
): DispatchScheduledTaskRunInput {
|
|
44
|
-
const base = {
|
|
45
|
-
workspaceId: input.workspaceId,
|
|
46
|
-
taskId: input.taskId,
|
|
47
|
-
producerKey,
|
|
48
|
-
};
|
|
49
|
-
return input.triggerType !== "scheduled"
|
|
50
|
-
? {
|
|
51
|
-
...base,
|
|
52
|
-
triggerType: input.triggerType,
|
|
53
|
-
agentRunUsageIdempotencyKey: input.agentRunUsageIdempotencyKey,
|
|
54
|
-
initiator: input.initiator,
|
|
55
|
-
...(input.credentialRestriction === "developer_setup"
|
|
56
|
-
? { credentialRestriction: input.credentialRestriction }
|
|
57
|
-
: {}),
|
|
58
|
-
}
|
|
59
|
-
: { ...base, triggerType: "scheduled" };
|
|
60
|
-
}
|
|
61
|
-
|
|
62
37
|
export async function scheduledTaskFireWorkflow(
|
|
63
38
|
input: ScheduledTaskFireWorkflowInput,
|
|
64
39
|
): Promise<void> {
|
|
@@ -72,8 +47,20 @@ export async function scheduledTaskFireWorkflow(
|
|
|
72
47
|
) {
|
|
73
48
|
return;
|
|
74
49
|
}
|
|
50
|
+
const base = {
|
|
51
|
+
workspaceId: input.workspaceId,
|
|
52
|
+
taskId: input.taskId,
|
|
53
|
+
producerKey: workflowInfo().workflowId,
|
|
54
|
+
};
|
|
75
55
|
const result = await scheduledTaskActivity.dispatchScheduledTaskRun(
|
|
76
|
-
|
|
56
|
+
input.triggerType !== "scheduled"
|
|
57
|
+
? {
|
|
58
|
+
...base,
|
|
59
|
+
triggerType: input.triggerType,
|
|
60
|
+
agentRunUsageIdempotencyKey: input.agentRunUsageIdempotencyKey,
|
|
61
|
+
initiator: input.initiator,
|
|
62
|
+
}
|
|
63
|
+
: { ...base, triggerType: "scheduled" },
|
|
77
64
|
);
|
|
78
65
|
if (result.action !== "knowledge_source_sync") return;
|
|
79
66
|
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { type TurnExecutionPolicyV1 } from "@opengeni/contracts";
|
|
2
|
-
/** Only accepted policies establish the ceiling; ordinary metadata is not authority. */
|
|
3
|
-
export declare function turnCredentialRestriction(acceptedPolicy: TurnExecutionPolicyV1, initialSessionMetadata: unknown): "developer_setup" | undefined;
|