Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,303 changes: 1,303 additions & 0 deletions assets/css/my-wordpress-woocommerce.css

Large diffs are not rendered by default.

Binary file added assets/images/woo-product-studio-placeholder.webp
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions docs/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,27 @@ fighting over `orderby` is exactly how this went wrong once already:
WooCommerce Blocks hooks `rest_product_query` at 10 and ends with
`array_merge( $args, …, $orderby_query )`, which is why ours runs at 99.

**Product creation.** The Woo folder's Product Studio launcher and the
**Add New Product** desktop shortcut open a dedicated native window rather
than dropping the merchant into the classic product editor. Its four-stage
draft stays browser-side, with a same-tab
session snapshot that recovers text, pricing, stock, and categories after an
accidental close or reload. File objects never enter browser storage, so a
recovered draft asks the merchant to reselect its image. Save draft or Publish
posts one nonce-authenticated multipart request to
`desktop-mode/v1/woocommerce/products`. The route validates the product
capabilities and image independently, ingests the image through WordPress
media, and persists a standard simple product through `WC_Product_Simple`.
Each draft carries a UUID stored as private, user-scoped product metadata; a
retry after a lost response returns the already-created product instead of
creating a duplicate or uploading the image twice.
The browser never receives a WooCommerce consumer key; cookie authentication
and the REST nonce cover the in-dashboard request, while WooCommerce's CRUD
layer remains the source of truth for prices, stock, categories, SKU
uniqueness, and product hooks. A companion read route at
`woocommerce/product-studio` supplies live categories, currency formatting,
upload limits, and publish capability for the current user.

**Ownership attribution.** `registered_post_type` / `registered_taxonomy`
fire during `init`, where `get_plugins()` does not yet exist — Core
loads `wp-admin/includes/plugin.php` at `wp-admin/admin.php:102`, after
Expand Down
67 changes: 67 additions & 0 deletions docs/hooks-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -3417,6 +3417,51 @@ types are submenu entries under the WooCommerce menu, so they carry no
`menu_icon` of their own and would otherwise fall back to the generic
post pin.

#### Product Studio

The Woo folder's **Create product** action and the **Add New Product**
desktop shortcut open a four-stage native
window backed by WooCommerce's product CRUD API. The window keeps an
unsaved draft and live storefront preview in the browser. It snapshots the
serializable fields in same-tab session storage so an accidental close or
reload is recoverable; product images must be reselected because file objects
are never stored. Saving sends a nonce-authenticated multipart request to `POST
desktop-mode/v1/woocommerce/products`. Product-type capabilities gate
creation and publishing separately; image uploads additionally require
`upload_files`. Every draft also sends a UUID `requestId`. The server stores it
as private, user-scoped product metadata and returns the existing product when
the same request is retried, preventing duplicate products after a lost
network response.

```php
apply_filters( 'openstation_my_wordpress_woo_product_studio_template_html', string $html ): string
```

The Product Studio window's static template before it is emitted. Keep
`data-os-woo-product-studio-root` intact so the Woo integration bundle
can mount the flow. The result passes through
`openstation_kses_native_window_template()`.

```php
apply_filters( 'openstation_my_wordpress_woo_product_studio_window_args', array $args ): array
```

The `openstation_register_window()` args for the Product Studio window:
title, icon, dimensions, shared Woo integration script/style handles,
and `placement => 'none'`.

```php
apply_filters( 'openstation_my_wordpress_woo_product_studio_icon_args', array $args ): array
```

The `openstation_register_icon()` args for the **Add New Product**
desktop shortcut: title, Dashicon, Product Studio window target, and
desktop position. The shortcut is not pinned, so the user can place or
hide it through the normal desktop-item controls.

All three filters are active only when WooCommerce is loaded and the viewer
can edit products.

#### Customers

The **Customers** section renders through the built-in `user` entity
Expand Down Expand Up @@ -4594,6 +4639,28 @@ row and definition meta.
- **Param** `array $args` — sanitized creation fields `{ name, role, description, instructions, abilities }`.
- **Param** `int $actor_id` — user who created the agent.

### `openstation_pre_agents_generate_blueprint` — Experimental *(filter)*

Short-circuits the model call behind `POST /agents/generate`. Return
an agent-definition array (`{ name, description, instructions, role,
abilities }`) or a `WP_Error`; return `null` to use the configured Core
AI Client. A returned definition still passes through the live role
and ability-catalogue validation before an agent is created.

- **Param** `array|WP_Error|null $generated`
- **Param** `string $brief` — the administrator's natural-language brief.
- **Param** `array $context` — assignable `roles` and available `abilities`.

### `openstation_agents_blueprint_instructions` — Experimental *(filter)*

Filters the system instruction used to turn the administrator's brief
into an agent definition. The dynamic role and ability catalogues are
sent separately in the user prompt and the structured response is
validated server-side.

- **Param** `string $instructions`
- **Param** `array $context` — assignable `roles` and available `abilities`.

### `openstation_agent_updated` — Experimental *(action)*

Fires once per `openstation_agent_update()` call that changed at
Expand Down
1 change: 1 addition & 0 deletions includes/my-wordpress/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
// Third-party integrations. Each file is inert unless its plugin is
// active, so requiring them unconditionally costs one include.
require_once __DIR__ . '/integrations/woocommerce.php';
require_once __DIR__ . '/integrations/woocommerce-product-studio.php';
require_once __DIR__ . '/integrations/woocommerce-customers.php';
require_once __DIR__ . '/integrations/woocommerce-customer-window.php';
require_once __DIR__ . '/integrations/woocommerce-relations.php';
Loading
Loading