@agent-native/core 0.222.1-nightly-20261029063606 → 0.222.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/agent/production-agent.d.ts +2 -0
- package/dist/agent/production-agent.js +86 -6
- package/dist/agent/run-store.js +3 -2
- package/dist/app-config/agent.d.ts +9 -0
- package/dist/app-config/agent.js +31 -0
- package/dist/app-config/schema.d.ts +9 -0
- package/dist/app-config/store.js +48 -5
- package/dist/collab/routes.d.ts +1 -1
- package/dist/collab/struct-routes.d.ts +1 -1
- package/dist/file-upload/actions/upload-image.d.ts +4 -4
- package/dist/jobs/run-history.js +3 -2
- package/dist/observability/hosted-model-experiment.d.ts +1 -1
- package/dist/observability/hosted-model-experiment.js +7 -1
- package/dist/observability/question-intake-experiment.d.ts +34 -0
- package/dist/observability/question-intake-experiment.js +114 -0
- package/dist/observability/traces.d.ts +4 -0
- package/dist/observability/traces.js +5 -4
- package/dist/observability/tracing.d.ts +1 -0
- package/dist/observability/tracing.js +14 -4
- package/dist/org/index.d.ts +1 -1
- package/dist/provider-api/actions/custom-provider-registration.d.ts +7 -7
- package/dist/provider-api/actions/provider-api.d.ts +7 -7
- package/dist/server/agent-engine-api-key-route.d.ts +3 -3
- package/dist/server/better-auth-instance.js +43 -0
- package/dist/server/builder-branch-files.d.ts +3 -1
- package/dist/server/builder-branch-files.js +74 -33
- package/dist/server/builder-branch-git.d.ts +1 -1
- package/dist/server/builder-branch-git.js +2 -0
- package/dist/server/core-routes-plugin.js +31 -4
- package/dist/server/request-context.d.ts +8 -0
- package/dist/server/transcribe-voice.d.ts +1 -1
- package/dist/shared/first-run-builder-credits-experiment.d.ts +1 -0
- package/dist/shared/first-run-builder-credits-experiment.js +19 -0
- package/dist/tracking/index.d.ts +1 -1
- package/dist/tracking/index.js +1 -1
- package/dist/tracking/registry.d.ts +7 -0
- package/dist/tracking/registry.js +84 -4
- package/package.json +4 -4
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { randomUUID } from "node:crypto";
|
|
2
|
-
import {
|
|
2
|
+
import { getAppConfig } from "../app-config/index.js";
|
|
3
|
+
import { questionIntakeExposureProperties, resolveQuestionIntakeExperimentAssignment, } from "../observability/question-intake-experiment.js";
|
|
4
|
+
import { queueTrackingEvent, registerTrackingWork, } from "../observability/tracing.js";
|
|
3
5
|
import { resolveDeployEnvironment } from "../server/deploy-environment.js";
|
|
4
|
-
import { getRequestContext } from "../server/request-context.js";
|
|
6
|
+
import { getRequestContext, getRequestRunContext, } from "../server/request-context.js";
|
|
5
7
|
import { isTestIdentity } from "../server/test-identity.js";
|
|
6
8
|
import { canonicalTrackingEvent, legacyLifecycleEvent, TRACKING_EVENT_ALIAS_ID_PROPERTY, withCanonicalTrackingProperties, } from "../shared/analytics-events.js";
|
|
7
9
|
import { ANALYTICS_CLIENT_PLATFORM_PROPERTY } from "../shared/analytics-platform.js";
|
|
8
|
-
import { assignFirstRunBuilderCreditsV2 } from "../shared/first-run-builder-credits-experiment.js";
|
|
10
|
+
import { assignFirstRunBuilderCreditsV2, FIRST_RUN_ONBOARDING_EXPERIMENT_EVENT_NAMES, } from "../shared/first-run-builder-credits-experiment.js";
|
|
9
11
|
export { isQaTestEmail } from "../shared/qa-test-email.js";
|
|
10
12
|
const REGISTRY_KEY = Symbol.for("@agent-native/core/tracking.registry");
|
|
11
13
|
const FIRST_RUN_EXPERIMENT_EVENT_NAMES = new Set([
|
|
@@ -98,6 +100,68 @@ function resolveTrackingSource(source) {
|
|
|
98
100
|
};
|
|
99
101
|
}
|
|
100
102
|
export function track(name, properties, source) {
|
|
103
|
+
// raw-sql-ok: tracking persistence uses bound arguments for resolved identity values.
|
|
104
|
+
const resolvedSource = resolveTrackingSource(source);
|
|
105
|
+
// raw-sql-ok: resolved IDs remain bound event values at the tracking store boundary.
|
|
106
|
+
const { authUserId, userId } = resolvedSource;
|
|
107
|
+
if (getRequestContext()?.isSyntheticTraffic === true)
|
|
108
|
+
return;
|
|
109
|
+
const testIdentity = testIdentityOf(userId, properties);
|
|
110
|
+
if (testIdentity && name !== "$exception")
|
|
111
|
+
return;
|
|
112
|
+
const config = getAppConfig().agent.questionIntake;
|
|
113
|
+
const mayAttributeClientEvent = resolvedSource.telemetryOrigin !== "client" ||
|
|
114
|
+
config?.clientTrackedEventNames.includes(name) === true;
|
|
115
|
+
if (config?.enabled &&
|
|
116
|
+
!config.disabled &&
|
|
117
|
+
config.trackedEventNames.includes(name) &&
|
|
118
|
+
authUserId &&
|
|
119
|
+
mayAttributeClientEvent) {
|
|
120
|
+
const experimentProperties = { ...(properties ?? {}) };
|
|
121
|
+
delete experimentProperties.experiment_id;
|
|
122
|
+
delete experimentProperties.experiment_variant;
|
|
123
|
+
const requestAssignment = getRequestRunContext()?.questionIntakeExperimentAssignment;
|
|
124
|
+
if (requestAssignment?.authUserId === authUserId &&
|
|
125
|
+
requestAssignment.experimentId === config.experimentId) {
|
|
126
|
+
emitTrackedEvent(name, experimentProperties, source, requestAssignment);
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
const pending = resolveQuestionIntakeExperimentAssignment(config, authUserId)
|
|
130
|
+
.then((assignment) => emitTrackedEvent(name, experimentProperties, source, assignment ?? undefined), () => {
|
|
131
|
+
console.error("[tracking] question-intake assignment lookup failed", {
|
|
132
|
+
experimentId: config.experimentId,
|
|
133
|
+
eventName: name,
|
|
134
|
+
});
|
|
135
|
+
emitTrackedEvent(name, experimentProperties, source);
|
|
136
|
+
})
|
|
137
|
+
.catch(() => {
|
|
138
|
+
console.error("[tracking] asynchronous event delivery failed");
|
|
139
|
+
});
|
|
140
|
+
registerTrackingWork(pending, getRequestContext()?.trackingScope);
|
|
141
|
+
const waitUntil = getRequestRunContext()?.waitUntil;
|
|
142
|
+
if (waitUntil) {
|
|
143
|
+
try {
|
|
144
|
+
waitUntil(pending);
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
catch {
|
|
148
|
+
console.error("[tracking] request waitUntil rejected tracked event");
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
void pending.catch(() => {
|
|
152
|
+
console.error("[tracking] tracked event failed outside waitUntil");
|
|
153
|
+
});
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
emitTrackedEvent(name, properties, source);
|
|
157
|
+
}
|
|
158
|
+
export function trackQuestionIntakeExposure(assignment, context) {
|
|
159
|
+
track("agent_experiment_exposed", questionIntakeExposureProperties(assignment, context), {
|
|
160
|
+
...(context.userId ? { userId: context.userId } : {}),
|
|
161
|
+
authUserId: assignment.authUserId,
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
function emitTrackedEvent(name, properties, source, questionIntakeAssignment) {
|
|
101
165
|
const { userId, authUserId, anonymousId, sessionId, occurredAt, telemetryOrigin, } = resolveTrackingSource(source);
|
|
102
166
|
if (getRequestContext()?.isSyntheticTraffic === true)
|
|
103
167
|
return;
|
|
@@ -109,14 +173,30 @@ export function track(name, properties, source) {
|
|
|
109
173
|
const safeProperties = { ...(properties ?? {}) };
|
|
110
174
|
delete safeProperties.auth_user_id;
|
|
111
175
|
delete safeProperties.authUserId;
|
|
176
|
+
delete safeProperties.telemetry_origin;
|
|
177
|
+
delete safeProperties.telemetryOrigin;
|
|
178
|
+
if (telemetryOrigin === "client") {
|
|
179
|
+
delete safeProperties.experiment_id;
|
|
180
|
+
delete safeProperties.experiment_variant;
|
|
181
|
+
}
|
|
112
182
|
if (authUserId)
|
|
113
183
|
safeProperties.auth_user_id = authUserId;
|
|
114
|
-
const firstRunExperiment = authUserId &&
|
|
184
|
+
const firstRunExperiment = authUserId &&
|
|
185
|
+
(FIRST_RUN_EXPERIMENT_EVENT_NAMES.has(name) ||
|
|
186
|
+
(FIRST_RUN_ONBOARDING_EXPERIMENT_EVENT_NAMES.has(name) &&
|
|
187
|
+
safeProperties.flow === "first_run"))
|
|
115
188
|
? requestFirstRunExperiment(authUserId)
|
|
116
189
|
: null;
|
|
117
190
|
const trackedProperties = withCanonicalTrackingProperties({
|
|
118
191
|
...safeProperties,
|
|
192
|
+
telemetry_origin: telemetryOrigin,
|
|
119
193
|
...(firstRunExperiment ?? {}),
|
|
194
|
+
...(questionIntakeAssignment
|
|
195
|
+
? {
|
|
196
|
+
experiment_id: questionIntakeAssignment.experimentId,
|
|
197
|
+
experiment_variant: questionIntakeAssignment.variantId,
|
|
198
|
+
}
|
|
199
|
+
: {}),
|
|
120
200
|
...(sessionId ? { session_id: sessionId } : {}),
|
|
121
201
|
...(userId ? { user_id: userId } : {}),
|
|
122
202
|
...(actionContext?.userEmail
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agent-native/core",
|
|
3
|
-
"version": "0.222.1
|
|
3
|
+
"version": "0.222.1",
|
|
4
4
|
"description": "The agentic application framework for building autonomous agents with intuitive UIs",
|
|
5
5
|
"homepage": "https://github.com/BuilderIO/agent-native#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -742,8 +742,8 @@
|
|
|
742
742
|
"yaml": "^2.9.0",
|
|
743
743
|
"yjs": "^13.6.33",
|
|
744
744
|
"zod": "^4.3.6",
|
|
745
|
-
"@agent-native/agentkit": "^0.222.1
|
|
746
|
-
"@agent-native/recap-cli": "^0.5.
|
|
745
|
+
"@agent-native/agentkit": "^0.222.1",
|
|
746
|
+
"@agent-native/recap-cli": "^0.5.92"
|
|
747
747
|
},
|
|
748
748
|
"devDependencies": {
|
|
749
749
|
"@ai-sdk/anthropic": "^3.0.71",
|
|
@@ -814,7 +814,7 @@
|
|
|
814
814
|
"xlsx": "^0.18.5"
|
|
815
815
|
},
|
|
816
816
|
"peerDependencies": {
|
|
817
|
-
"@agent-native/core-corpus": "0.
|
|
817
|
+
"@agent-native/core-corpus": ">=0.196.0",
|
|
818
818
|
"@ai-sdk/anthropic": ">=3",
|
|
819
819
|
"@ai-sdk/cohere": ">=3",
|
|
820
820
|
"@ai-sdk/google": ">=3",
|