osagent 0.2.74 → 0.2.76

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.
Files changed (2) hide show
  1. package/cli.js +47 -13
  2. package/package.json +1 -1
package/cli.js CHANGED
@@ -133087,7 +133087,7 @@ var init_geminiContentGenerator = __esm({
133087
133087
  }
133088
133088
  models;
133089
133089
  constructor(contentGeneratorConfig, config2) {
133090
- const version3 = "0.2.74";
133090
+ const version3 = "0.2.76";
133091
133091
  const userAgent2 = `OSAgent/${version3} (${process.platform}; ${process.arch})`;
133092
133092
  let headers = {
133093
133093
  "User-Agent": userAgent2
@@ -143450,6 +143450,7 @@ var init_pipeline = __esm({
143450
143450
  init_esbuild_shims();
143451
143451
  init_node();
143452
143452
  init_converter2();
143453
+ init_uiTelemetry();
143453
143454
  ContentGenerationPipeline = class {
143454
143455
  static {
143455
143456
  __name(this, "ContentGenerationPipeline");
@@ -143470,6 +143471,9 @@ var init_pipeline = __esm({
143470
143471
  signal: request4.config?.abortSignal
143471
143472
  });
143472
143473
  const OSAResponse = this.converter.convertOpenAIResponseToOSA(openaiResponse);
143474
+ if (OSAResponse.usageMetadata?.promptTokenCount !== void 0) {
143475
+ uiTelemetryService.setLastPromptTokenCount(OSAResponse.usageMetadata.promptTokenCount);
143476
+ }
143473
143477
  await this.config.telemetryService.logSuccess(context2, OSAResponse, openaiRequest, openaiResponse);
143474
143478
  return OSAResponse;
143475
143479
  });
@@ -143495,7 +143499,7 @@ var init_pipeline = __esm({
143495
143499
  const collectedOSAResponses = [];
143496
143500
  const collectedOpenAIChunks = [];
143497
143501
  this.converter.resetStreamingToolCalls();
143498
- let pendingFinishResponse = null;
143502
+ const pendingState = { response: null };
143499
143503
  try {
143500
143504
  for await (const chunk of stream2) {
143501
143505
  collectedOpenAIChunks.push(chunk);
@@ -143504,19 +143508,26 @@ var init_pipeline = __esm({
143504
143508
  continue;
143505
143509
  }
143506
143510
  const shouldYield = this.handleChunkMerging(response, collectedOSAResponses, (mergedResponse) => {
143507
- pendingFinishResponse = mergedResponse;
143511
+ pendingState.response = mergedResponse;
143508
143512
  });
143509
143513
  if (shouldYield) {
143510
- if (pendingFinishResponse) {
143511
- yield pendingFinishResponse;
143512
- pendingFinishResponse = null;
143514
+ const responseToYield = pendingState.response || response;
143515
+ if (responseToYield.usageMetadata?.promptTokenCount !== void 0) {
143516
+ uiTelemetryService.setLastPromptTokenCount(responseToYield.usageMetadata.promptTokenCount);
143517
+ }
143518
+ if (pendingState.response) {
143519
+ yield pendingState.response;
143520
+ pendingState.response = null;
143513
143521
  } else {
143514
143522
  yield response;
143515
143523
  }
143516
143524
  }
143517
143525
  }
143518
- if (pendingFinishResponse) {
143519
- yield pendingFinishResponse;
143526
+ if (pendingState.response) {
143527
+ if (pendingState.response.usageMetadata?.promptTokenCount !== void 0) {
143528
+ uiTelemetryService.setLastPromptTokenCount(pendingState.response.usageMetadata.promptTokenCount);
143529
+ }
143530
+ yield pendingState.response;
143520
143531
  }
143521
143532
  if (this.converter.hasPendingToolCalls()) {
143522
143533
  const incompletePartsList = this.converter.finalizeIncompleteToolCalls();
@@ -152996,7 +153007,7 @@ function createContentGeneratorConfig(config2, authType, generationConfig) {
152996
153007
  };
152997
153008
  }
152998
153009
  async function createContentGenerator(config2, gcConfig, sessionId2, isInitialAuth) {
152999
- const version3 = "0.2.74";
153010
+ const version3 = "0.2.76";
153000
153011
  const userAgent2 = `OSAgent/${version3} (${process.platform}; ${process.arch})`;
153001
153012
  const baseHeaders = {
153002
153013
  "User-Agent": userAgent2
@@ -251976,9 +251987,30 @@ I've found some existing telemetry code. Let me mark the first todo as in_progre
251976
251987
 
251977
251988
  # Primary Workflows
251978
251989
 
251990
+ ## CRITICAL: Project Context Discovery (Do This FIRST)
251991
+
251992
+ **BEFORE doing ANY work on a project, you MUST check for project context:**
251993
+
251994
+ 1. **Check for OSAGENT.md:** Use '${ToolNames.READ_FILE}' to check if \`OSAGENT.md\` exists in the project root directory. This file contains critical project-specific instructions, conventions, and context that you MUST follow.
251995
+
251996
+ 2. **If OSAGENT.md exists:** Read it completely and follow ALL instructions within it. This file takes precedence over default behaviors. It may contain:
251997
+ - Project architecture and structure
251998
+ - Coding conventions and patterns to follow
251999
+ - Files and directories that should not be modified
252000
+ - Specific workflows or approval requirements
252001
+ - Technology stack details
252002
+ - Testing and build commands
252003
+
252004
+ 3. **If OSAGENT.md does not exist:** Proceed with normal project discovery (check package.json, README, etc.) but consider suggesting the user create one for future sessions.
252005
+
252006
+ 4. **Also check for .osagent/ directory:** Look for \`.osagent/settings.json\` or \`.osagent/system.md\` which may contain additional configuration.
252007
+
252008
+ **This step is NON-NEGOTIABLE. Do NOT skip it even for simple requests like "hello world". The project context file may contain critical information about what is and isn't allowed.**
252009
+
251979
252010
  ## Software Engineering Tasks
251980
252011
  When requested to perform tasks like fixing bugs, adding features, refactoring, or explaining code, follow this iterative approach:
251981
- - **Plan:** After understanding the user's request, create an initial plan based on your existing knowledge and any immediately obvious context. Use the '${ToolNames.TODO_WRITE}' tool to capture this rough plan for complex or multi-step work. Don't wait for complete understanding - start with what you know.
252012
+ - **FIRST: Check Context:** Before doing anything else, follow the "Project Context Discovery" steps above. Check for \`OSAGENT.md\` in the project root. This is mandatory.
252013
+ - **Plan:** After understanding the user's request and reading any project context files, create an initial plan based on your existing knowledge and the project's conventions. Use the '${ToolNames.TODO_WRITE}' tool to capture this rough plan for complex or multi-step work. Don't wait for complete understanding - start with what you know.
251982
252014
  - **Implement:** Begin implementing the plan while gathering additional context as needed. Use '${ToolNames.GREP}', '${ToolNames.GLOB}', '${ToolNames.READ_FILE}', and '${ToolNames.READ_MANY_FILES}' tools strategically when you encounter specific unknowns during implementation. Use the available tools (e.g., '${ToolNames.EDIT}', '${ToolNames.WRITE_FILE}' '${ToolNames.SHELL}' ...) to act on the plan, strictly adhering to the project's established conventions (detailed under 'Core Mandates').
251983
252015
  - **Adapt:** As you discover new information or encounter obstacles, update your plan and todos accordingly. Mark todos as in_progress when starting and completed when finishing each task. Add new todos if the scope expands. Refine your approach based on what you learn.
251984
252016
  - **Verify (Tests):** If applicable and feasible, verify the changes using the project's testing procedures. Identify the correct test commands and frameworks by examining 'README' files, build/package configuration (e.g., 'package.json'), or existing test execution patterns. NEVER assume standard test commands.
@@ -251994,6 +252026,8 @@ IMPORTANT: Always use the ${ToolNames.TODO_WRITE} tool to plan and track tasks t
251994
252026
 
251995
252027
  **Goal:** Autonomously implement and deliver complete, scalable foundations - from simple prototypes to full Operating Systems. Think beyond single applications: help users build ecosystems that can grow with their needs.
251996
252028
 
252029
+ 0. **FIRST: Check Project Context:** Before starting ANY work, follow the "Project Context Discovery" steps above. Check for \`OSAGENT.md\` in the project root. If it exists, it may contain critical project guidelines, architecture decisions, or restrictions that you MUST follow.
252030
+
251997
252031
  1. **Understand Requirements:** Analyze the user's request to identify:
251998
252032
  - **Scope:** Is this a single app, or a foundation/OS for a larger system?
251999
252033
  - **Use Case:** Business operations, content creation, development tooling, automation, etc.
@@ -340481,7 +340515,7 @@ __name(getPackageJson, "getPackageJson");
340481
340515
  // packages/cli/src/utils/version.ts
340482
340516
  async function getCliVersion() {
340483
340517
  const pkgJson = await getPackageJson();
340484
- return "0.2.74";
340518
+ return "0.2.76";
340485
340519
  }
340486
340520
  __name(getCliVersion, "getCliVersion");
340487
340521
 
@@ -344682,8 +344716,8 @@ var formatDuration = /* @__PURE__ */ __name((milliseconds) => {
344682
344716
 
344683
344717
  // packages/cli/src/generated/git-commit.ts
344684
344718
  init_esbuild_shims();
344685
- var GIT_COMMIT_INFO2 = "5db4b6a";
344686
- var CLI_VERSION2 = "0.2.74";
344719
+ var GIT_COMMIT_INFO2 = "c69e8c7";
344720
+ var CLI_VERSION2 = "0.2.76";
344687
344721
 
344688
344722
  // packages/cli/src/utils/systemInfo.ts
344689
344723
  async function getNpmVersion() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "osagent",
3
- "version": "0.2.74",
3
+ "version": "0.2.76",
4
4
  "description": "OS Agent - AI-powered CLI for autonomous coding with Ollama Cloud and Qwen models",
5
5
  "repository": {
6
6
  "type": "git",