@shaxpir/duiduidui-models 1.26.1 → 1.27.0

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.
@@ -23,7 +23,7 @@ export interface ToolUseBlock {
23
23
  export interface ToolResultBlock {
24
24
  type: 'tool_result';
25
25
  tool_use_id: string;
26
- content: string;
26
+ content: any;
27
27
  is_error?: boolean;
28
28
  }
29
29
  export interface ThinkingBlock {
@@ -174,13 +174,24 @@ class Workspace extends Content_1.Content {
174
174
  async acquireSessionForUtcTime(utcTime) {
175
175
  this.checkDisposed("Workspace.acquireSessionForUtcTime");
176
176
  const shareSync = repo_1.ShareSyncFactory.get();
177
+ // First, try direct ref match — if the utcTime exactly matches a
178
+ // session's created_at, we can acquire by ref without range checking.
177
179
  for (let i = 0, len = this.sessions.length; i < len; i++) {
178
180
  const sessionCreatedAt = this.sessions.get(i);
179
- if (shaxpir_common_1.Time.isDateTimeBefore(sessionCreatedAt.utc_time, utcTime)) {
181
+ if (sessionCreatedAt.utc_time === utcTime) {
182
+ const sessionRef = Session_1.Session.makeSessionRef(this.owner, sessionCreatedAt);
183
+ return await shareSync.acquire(ContentKind_1.ContentKind.SESSION, sessionRef);
184
+ }
185
+ }
186
+ // Fall back to range match — find the session that contains utcTime
187
+ // (created_at <= utcTime <= updated_at).
188
+ for (let i = 0, len = this.sessions.length; i < len; i++) {
189
+ const sessionCreatedAt = this.sessions.get(i);
190
+ if (!shaxpir_common_1.Time.isDateTimeAfter(sessionCreatedAt.utc_time, utcTime)) {
180
191
  const sessionRef = Session_1.Session.makeSessionRef(this.owner, sessionCreatedAt);
181
192
  const session = await shareSync.acquire(ContentKind_1.ContentKind.SESSION, sessionRef);
182
193
  const sessionUpdatedAt = session.updatedAt;
183
- if (shaxpir_common_1.Time.isDateTimeAfter(sessionUpdatedAt.utc_time, utcTime)) {
194
+ if (!shaxpir_common_1.Time.isDateTimeBefore(sessionUpdatedAt.utc_time, utcTime)) {
184
195
  return session;
185
196
  }
186
197
  else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shaxpir/duiduidui-models",
3
- "version": "1.26.1",
3
+ "version": "1.27.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/shaxpir/duiduidui-models"