From ff2d3244329743b4da12d255606b206ec960369c Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 16 Nov 2026 11:28:06 +0000 Subject: [PATCH] ci: release packages --- .changeset/windows-desktop-build.md | 5 -- apps/desktop/CHANGELOG.md | 6 ++ apps/desktop/package.json | 2 +- .../src/session-rating/common/gates.d.ts | 40 +++++++++++++ .../src/session-rating/common/types.d.ts | 22 +++++++ .../session-rating/node/cooldown-store.d.ts | 6 ++ .../session-rating/node/event-properties.d.ts | 59 +++++++++++++++++++ .../src/session-rating/node/ledger.d.ts | 27 +++++++++ .../src/session-rating/node/survey-turns.d.ts | 21 +++++++ 9 files changed, 182 insertions(+), 6 deletions(-) delete mode 100644 .changeset/windows-desktop-build.md create mode 100644 packages/product/src/session-rating/common/gates.d.ts create mode 100644 packages/product/src/session-rating/common/types.d.ts create mode 100644 packages/product/src/session-rating/node/cooldown-store.d.ts create mode 100644 packages/product/src/session-rating/node/event-properties.d.ts create mode 100644 packages/product/src/session-rating/node/ledger.d.ts create mode 100644 packages/product/src/session-rating/node/survey-turns.d.ts diff --git a/.changeset/windows-desktop-build.md b/.changeset/windows-desktop-build.md deleted file mode 100644 index e28c7519d..000000000 --- a/.changeset/windows-desktop-build.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@pymodel/pythinker-desktop": patch ---- - -Fix the Windows desktop installer build. diff --git a/apps/desktop/CHANGELOG.md b/apps/desktop/CHANGELOG.md index f51c490c0..7d865dcaa 100644 --- a/apps/desktop/CHANGELOG.md +++ b/apps/desktop/CHANGELOG.md @@ -1,5 +1,11 @@ # @pymodel/pythinker-desktop +## 2.0.2 + +### Patch Changes + +- [#413](https://github.com/PyModel/pythinker-code/pull/413) [`cd4241b`](https://github.com/PyModel/pythinker-code/commit/cd4241bf15eed910e675bf157ee63835b5a68028) Thanks [@elkaix](https://github.com/elkaix)! - Fix the Windows desktop installer build. + ## 2.0.1 ### Patch Changes diff --git a/apps/desktop/package.json b/apps/desktop/package.json index 6bbd05432..b25ef58f2 100644 --- a/apps/desktop/package.json +++ b/apps/desktop/package.json @@ -1,7 +1,7 @@ { "name": "@pymodel/pythinker-desktop", "description": "Pythinker desktop application with tray-owned Host lifecycle", - "version": "2.0.1", + "version": "2.0.2", "private": true, "type": "module", "main": "dist/main.js", diff --git a/packages/product/src/session-rating/common/gates.d.ts b/packages/product/src/session-rating/common/gates.d.ts new file mode 100644 index 000000000..1036e945e --- /dev/null +++ b/packages/product/src/session-rating/common/gates.d.ts @@ -0,0 +1,40 @@ +import type { SurveyKind } from './types'; +import type { SurveyPopupConfig } from './survey-popup-config'; +export type SurveyGateSkipReason = 'mount-roll-consumed' | 'mount-survey-shown' | 'turn-in-progress' | 'feature-disabled' | 'telemetry-disabled' | 'warmup' | 'pacing' | 'threshold-invalid' | 'below-threshold' | 'sampled-out' | 'global-cooldown'; +export interface SharedArmGateInput { + readonly turnInProgress: boolean; + readonly feedbackSurveyDisabled: boolean; + readonly telemetryDisabled: boolean; +} +export interface SessionArmGateInput extends SharedArmGateInput { + readonly mountedForMs: number; + readonly userTurnsSinceMount: number; + readonly msSinceLastShown: number | undefined; + readonly userTurnsSinceLastShown: number | undefined; + readonly sample: number; + readonly msSinceGlobalLastShown: number | undefined; +} +export interface LongContextArmGateInput extends SharedArmGateInput { + readonly cumulativeTokens: number; + readonly virtualContextTokens: number; + readonly mountRollConsumed: boolean; + readonly mountSurveyShown: boolean; + readonly msSinceGlobalLastShown: number | undefined; + readonly drawMountRoll: () => number; +} +export interface SurveyGateInput { + readonly session: SessionArmGateInput; + readonly longContext: LongContextArmGateInput; + readonly config: SurveyPopupConfig; +} +export type SurveyGateVerdict = { + readonly show: true; + readonly survey: SurveyKind; + readonly longContextRollConsumed?: boolean; +} | { + readonly show: false; + readonly reason: SurveyGateSkipReason; + readonly longContextRollConsumed?: boolean; +}; +export declare function evaluateLongContextArm(input: SurveyGateInput): SurveyGateVerdict; +export declare function evaluateSurveyGate(input: SurveyGateInput): SurveyGateVerdict; diff --git a/packages/product/src/session-rating/common/types.d.ts b/packages/product/src/session-rating/common/types.d.ts new file mode 100644 index 000000000..f3e7a57ae --- /dev/null +++ b/packages/product/src/session-rating/common/types.d.ts @@ -0,0 +1,22 @@ +export type SurveyKind = 'session' | 'long_context'; +export type RatingResponse = 'bad' | 'fine' | 'good'; +export type SurveyResponse = RatingResponse | 'dismissed'; +export type SurveyEventType = 'appeared' | 'responded' | 'abandoned'; +export interface RatingOffer { + readonly appearanceId: string; + readonly survey: SurveyKind; +} +export interface SurveyAppearance extends RatingOffer { + readonly appearanceIndex: number; +} +export type RatingReport = { + readonly type: 'shown' | 'abandon'; + readonly appearanceId: string; +} | { + readonly type: 'respond'; + readonly appearanceId: string; + readonly response: SurveyResponse; +}; +export interface RatingTrackContext { + readonly sessionId: string; +} diff --git a/packages/product/src/session-rating/node/cooldown-store.d.ts b/packages/product/src/session-rating/node/cooldown-store.d.ts new file mode 100644 index 000000000..92a2842ae --- /dev/null +++ b/packages/product/src/session-rating/node/cooldown-store.d.ts @@ -0,0 +1,6 @@ +export declare const RATING_COOLDOWN_FILE_NAME = "feedback-survey-state.json"; +export interface RatingCooldownStore { + read(): number | undefined; + write(lastShownTime: number): void; +} +export declare function ratingCooldownFile(dataDir: string): RatingCooldownStore; diff --git a/packages/product/src/session-rating/node/event-properties.d.ts b/packages/product/src/session-rating/node/event-properties.d.ts new file mode 100644 index 000000000..671129724 --- /dev/null +++ b/packages/product/src/session-rating/node/event-properties.d.ts @@ -0,0 +1,59 @@ +import type { SurveyEventType, SurveyResponse } from '../common/types'; +import type { SurveyPopupConfig } from '../common/survey-popup-config'; +export declare const SURVEY_EVENT_NAMES: { + readonly session: 'feedback_survey'; + readonly long_context: 'long_context_survey'; +}; +export type SurveyEventName = keyof typeof surveyEventDefinitions; +export interface SurveyEventProperties { + event_type: 'appeared' | 'responded' | 'abandoned'; + appearance_id: string; + appearance_index: number; + response?: 'bad' | 'fine' | 'good' | 'dismissed'; + current_model: string; + user_turn_count?: number; + cumulative_tokens: number; + virtual_context_tokens: number; + tool_call_count: number; + compaction_count: number; + permission_mode: string; + thinking_effort: string; + subagent_count: number; + subagent_models?: string; + dynamic_workflow_run_count: number; + dynamic_workflow_models?: string; + config_probability: number; + config_min_time_before_feedback_ms: number; + config_min_user_turns_before_feedback: number; + config_min_time_between_feedback_ms: number; + config_min_user_turns_between_feedback: number; + config_min_time_between_global_feedback_ms: number; + config_long_context_survey_threshold: number; + config_long_context_probability: number; + config_long_context_trigger_mode: 'cumulative' | 'virtual_context'; +} +export interface SurveyEventCoreFields { + readonly event_type: SurveyEventType; + readonly appearance_id: string; + readonly appearance_index: number; + readonly response?: SurveyResponse; +} +export interface SurveyEventEnvironmentFields { + readonly current_model: string; + readonly user_turn_count?: number; + readonly cumulative_tokens: number; + readonly virtual_context_tokens: number; + readonly tool_call_count: number; + readonly compaction_count: number; + readonly permission_mode: string; + readonly thinking_effort: string; + readonly subagent_count: number; + readonly subagent_models?: string; + readonly dynamic_workflow_run_count: number; + readonly dynamic_workflow_models?: string; +} +export declare const surveyEventDefinitions: { + readonly feedback_survey: import("@pymodel/agent-core-v2").TelemetryEventDefinition; + readonly long_context_survey: import("@pymodel/agent-core-v2").TelemetryEventDefinition; +}; +export declare function buildSurveyEventProperties(core: SurveyEventCoreFields, environment: SurveyEventEnvironmentFields, config: SurveyPopupConfig): SurveyEventProperties; diff --git a/packages/product/src/session-rating/node/ledger.d.ts b/packages/product/src/session-rating/node/ledger.d.ts new file mode 100644 index 000000000..861b26fad --- /dev/null +++ b/packages/product/src/session-rating/node/ledger.d.ts @@ -0,0 +1,27 @@ +import type { SurveyEventName, SurveyEventProperties } from './event-properties'; +import type { RatingReport, RatingTrackContext } from '../common/types'; +export declare const RATING_REPORT_RETENTION_MS: number; +export declare const RATING_REPORT_CAPACITY = 1024; +export type RatingTracker = (event: SurveyEventName, properties: SurveyEventProperties, context: RatingTrackContext) => void; +export interface RatingRegistration { + readonly mount: symbol; + readonly event: SurveyEventName; + readonly properties: SurveyEventProperties; + readonly context: RatingTrackContext; + readonly track: RatingTracker; +} +export declare class SessionRatingLedger { + private readonly deps; + private readonly entries; + constructor(deps: { + readonly telemetryDisabled: () => boolean; + readonly now?: () => number; + }); + register(registration: RatingRegistration): void; + report(sessionId: string, report: RatingReport): void; + detach(mount: symbol): void; + clear(): void; + private track; + private prune; + private now; +} diff --git a/packages/product/src/session-rating/node/survey-turns.d.ts b/packages/product/src/session-rating/node/survey-turns.d.ts new file mode 100644 index 000000000..ffa6dfabc --- /dev/null +++ b/packages/product/src/session-rating/node/survey-turns.d.ts @@ -0,0 +1,21 @@ +import type { IEventDispatcher, IDisposable } from '@pymodel/agent-core-v2'; +export interface SurveyTurnRecovery { + readonly userTurnCount: number; + readonly firstPromptAt?: number; + readonly origin: unknown; + readonly traceId?: string; + readonly endedAt?: number; +} +export interface MountedSurveyTurnCounter extends IDisposable { + readonly count: number | undefined; + readonly whenAttached: Promise; + recovery(): SurveyTurnRecovery | undefined; +} +export declare function mountSurveyTurnCounter(dispatcher: IEventDispatcher): MountedSurveyTurnCounter; +export declare class SurveyTurnCounter { + private history; + get count(): number | undefined; + observe(record: unknown, position: number): void; + invalidate(): void; +} +export declare function isSurveyTurnOrigin(origin: unknown): boolean | undefined;